triveous-assignment

This repository contains API documentation for Triveous E-commerce-backend

Video Demonstration

https://drive.google.com/file/d/19FRGvdoSAOUuRQ3A-puLb5HuBTHZD0OL/view?usp=drive_link

Tech-Stack-Used

nodejs express mongo npm

API Endpoints

Home

GET https://kind-lime-bass-tam.cyclic.app

User

Signup

POST https://kind-lime-bass-tam.cyclic.app/signUp
  {
    name: string (required),
    email: demoo@gmail.com in email format (required),
    password: 123456,
    role: (admin seller or default customer)
  }
200 (Ok): { msg: "user already exist" }
201 (ok): { msg: "signup has been done"}

Login

  POST https://kind-lime-bass-tam.cyclic.app/logIn
  {
    
    email: demoo@gmail.com in email format (required),
    password: 123456,
    
  }
200 (Ok): { msg: "login successful", token }
401 (account does not exists): {msg: 'user not found'  }

Logout

  POST https://kind-lime-bass-tam.cyclic.app/logout
res.status(200).send({ msg: "logout successfull" });
res.status(500).send({ msg: "something went wrong" });

Delete user

  Delete https://kind-lime-bass-tam.cyclic.app/user

Role:Admin

res.status(204).send({ "msg": "user has been deleted" })
res.status(500).send({ msg: "something went wrong" });

Product

Add Product

  POST https://kind-lime-bass-tam.cyclic.app/addProducts
  {
 title:string (required)
 category:string (required)
 description:string (required)
 price:Number (required)
 category:String
}

Role: seller

return res.status(201).send({ msg: "product addedd successfully" })
res.status(500).send({ msg: "something went wrong try again " })

GetProduct By Category

  GET https://kind-lime-bass-tam.cyclic.app/getProductsByCategory
res.status(200).send({ products: products })
res.status(500).send({ msg: "something went wrong try again " })

GetProduct By id

  GET https://kind-lime-bass-tam.cyclic.app/getproductById
res.status(200).send({ products: products })
res.status(500).send({ msg: "something went wrong try again " })

Remove Product

  DELETE https://kind-lime-bass-tam.cyclic.app/RemoveProducts
res.status(201).send({ msg: " Product has been removed" });
res.status(500).send({ msg: "something went wrong try again " })

Update Product

  PATCH https://kind-lime-bass-tam.cyclic.app/updateProducts
res.status(201).send({ msg: " Product has been updated" });
res.status(500).send({ msg: "something went wrong try again " })

Cart

Add to Cart

  POST https://kind-lime-bass-tam.cyclic.app/AddToCart
res.status(204).send({ "msg": "product already exist in your cart" })
res.status(500).send({ msg: "something went wrong try again " })
res.status(201).send({ msg: "product has been added in cart" });

Remove From Cart

  DELETE https://kind-lime-bass-tam.cyclic.app/RemoveFromCart
res.status(204).send({ msg: "product has been removed from cart" });
res.status(500).send({ msg: "something went wrong try again " })

Update Cart Product

  PATCH https://kind-lime-bass-tam.cyclic.app/UpdateCartProduct 
res.status(204).send({ msg: "product has been updated in cart" });
res.status(500).send({ msg: "something went wrong try again " })

Get Cart Products

  GET https://kind-lime-bass-tam.cyclic.app/GetCartProducts
res.status(200).send(AllCartProducts);
res.status(500).send({ msg: "something went wrong try again " })

Order

Order place

  POST https://kind-lime-bass-tam.cyclic.app/Orderplaced
res.status(201).send({ "msg": "order has been placed" })
res.status(500).send({ msg: "something went wrong try again " })

Get All Order History

  GET https://kind-lime-bass-tam.cyclic.app/GetAllOrderHistory
res.status(200).send(AllOrderProducts)
res.status(500).send({ msg: "something went wrong try again " })

Get User History

  GET https://kind-lime-bass-tam.cyclic.app/GetparticularUserHistory
res.status(200).send(UserOrderHistory)
res.status(500).send({ msg: "something went wrong try again " })
res.status(404).send({ "msg": "Did not placed any order" })