Skip to content

Commit

Permalink
Improved readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sujal-98 committed May 18, 2024
1 parent 46a4356 commit f56e525
Showing 1 changed file with 149 additions and 2 deletions.
151 changes: 149 additions & 2 deletions New_APIs/Ecom/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,155 @@ npm installed


### Create a .env file in the root directory and add your environment variables:

PORT=Your_Desired_Port
MONGO_URL=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
SECRET_PHRASE=your_secret_phrase
SECRET_PHRASE=your_secret_phrase

### API ENDPOINTS

**Authentication**
- Register
Endpoint: /api/auth/register
Method: POST
Description: Register a new user.
Body:
{
"username": "exampleuser",
"email": "[email protected]",
"password": "password"
}

- Login
Endpoint: /api/auth/login
Method: POST
Description: Login a user.
Body:
{
"username": "exampleuser",
"password": "password"
}

**User Management**

- Update User
Endpoint: /api/user/:id
Method: PUT
Description: Update a user's information.
Authorization: Requires token verification.

- Delete User
Endpoint: /api/user/:id
Method: DELETE
Description: Delete a user.
Authorization: Requires token verification.

- Get User
Endpoint: /api/user/find/:id
Method: GET
Description: Get a user's information.
Authorization: Requires admin verification.

- Get All Users
Endpoint: /api/user
Method: GET
Description: Get all users.
Authorization: Requires admin verification.

**Product Management**

- Add Product
Endpoint: /api/prod/add
Method: POST
Description: Add a new product.
Authorization: Requires admin verification.

- Update Product
Endpoint: /api/prod/upd/:id
Method: PUT
Description: Update a product.
Authorization: Requires admin verification.

- Delete Product
Endpoint: /api/prod/del/:id
Method: DELETE
Description: Delete a product.
Authorization: Requires admin verification.

- Get Product
Endpoint: /api/prod/find/:id
Method: GET
Description: Get a product by ID.

- Get All Products
Endpoint: /api/prod
Method: GET
Description: Get all products, with optional filtering by new or category.

**Cart Management**

- Add to Cart
Endpoint: /api/car/add
Method: POST
Description: Add a new item to the cart.
Authorization: Requires token verification.

- Update Cart
Endpoint: /api/car/upd/:id
Method: PUT
Description: Update a cart item.
Authorization: Requires token verification.

- Delete Cart Item
Endpoint: /api/car/del/:id
Method: DELETE
Description: Delete a cart item.
Authorization: Requires token verification.

- Get Cart
Endpoint: /api/car/find/:id
Method: GET
Description: Get cart items for a user.

- Get All Carts
Endpoint: /api/car
Method: GET
Description: Get all cart items.
Authorization: Requires admin verification.

**Order Management**

- Add Order
Endpoint: /api/ord/add
Method: POST
Description: Add a new order.
Authorization: Requires token verification.

- Update Order
Endpoint: /api/ord/upd/:id
Method: PUT
Description: Update an order.
Authorization: Requires admin verification.

- Delete Order
Endpoint: /api/ord/del/:id
Method: DELETE
Description: Delete an order.
Authorization: Requires admin verification.

- Get Order
Endpoint: /api/ord/find/:id
Method: GET
Description: Get an order by user ID.

- Get All Orders
Endpoint: /api/ord
Method: GET
Description: Get all orders.
Authorization: Requires admin verification.

- Get Monthly Income
Endpoint: /api/ord/income
Method: GET
Description: Get monthly income.
Authorization: Requires admin verification.

0 comments on commit f56e525

Please sign in to comment.