Triveous Assignment

The assignment I completed is the "BACKEND ASSIGNMENT: 'Ecommerce API with Node.js'" and used MongoDB as Database.

Getting Started

Explain how to set up and run your project locally. Include steps for installing dependencies, configuring environment variables, and starting the development server.

Installation

npm install

Start Project

npm run dummy-data
num start

API Documentation

User Endpoints

Create User

POST /user/register

Create a new user.

User Login

POST /user/login

User login.

Cart Endpoints

Get User's Cart

GET /cart/

Get all items in the user's cart.

Add Item to Cart

POST /cart/add

Add a product to the user's cart.

Delete Item from Cart

DELETE /cart/remove/${ProductID}

Delete a product from the user's cart.

Update Item in Cart

PUT /cart/update/${ProductID}

Update the quantity of a product in the user's cart.

Category Endpoints

Post All Categories

POST /api/category/listing

Get a list of all product categories.

Product Endpoints

Get All Products

GET /product/

Get a list of all products.

Get Product by ID

GET /product/${id}

Get product details by its ID.

Add Product

POST /product/

Add a new product.

Delete Product by ID

DELETE /product/delete/${id}

Delete a product by its ID.

Add Order

POST /order/

Add an order to the user's order history.

Get Order History

GET /order/history

Get the user's order history.

Get Order by ID

GET /cart/${id}

Get order details by its ID.