This is an API for an e-commerce platform built using Node.js and various libraries and frameworks. It provides endpoints for product and category management, user authentication, cart management, and order processing.
Follow these steps to set up and run the project:
Make sure you have Node.js and npm installed on your machine.
-
Clone the repository to your local machine:
git clone <https://github.com/Ayush-kr-shanu/Ecommerce_API> cd Ecommerce_API
-
Install the project dependencies:
npm install
DATABASE=data base name
USER=root
PASS=your_password
HOST=localhost
DILACT=mysql
JWT_CODE=your_secret_jwt_code
Replace your_password
and your_secret_jwt_code
with your actual database password and JWT secret code.
Run the server using the following command: npm run server
The API will start running on port 3001.
Register a new user: POST /register
Log in as a user: POST /login
Get a list of categories: GET /category
Create a new category: POST /category
Update a category by ID: PUT /category/:categoryId
Delete a category by ID: DELETE /category/:categoryId
Get a list of products: GET /product
Get a product by ID: GET /product/:productId
Create a new product: POST /product
Update a product by ID: PUT /product/:productId
Delete a product by ID: DELETE /product/:productId
View the user's cart: GET /cart
Add a product to the user's cart: POST /cart
Update a cart item by ID: PUT /cart/: cartItemId
Remove a cart item by ID: DELETE /cart/:cartItemId
Get the user's order history: GET /order
Place a new order with products from the user's cart: POST /order
Get order details by ID: GET /order/:orderId