This is a restAPI for e-commerce website. It has all the feature of registering user, login user, adding product to database and ordering it step by step.
Server : NodeJs, ExpressJs, MongoDB, Mongoose
Install ekart with npm install
npm install
POST /users/register
Form | Type | Description |
---|---|---|
name |
string |
Required. |
email |
string |
Required. |
password |
string |
Required. (min length six) |
POST /users/login
Form | Type | Description |
---|---|---|
email |
string |
Required |
password |
string |
Required. (min length six) |
POST /products/add-products
Form | Type | Description |
---|---|---|
name |
string |
Required |
price |
string |
Required |
images |
file |
Required |
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Only admin |
GET /products/get
GET /products/get/:productID
Params | Type | Description |
---|---|---|
:productID |
string |
Required |
POST /products/get/:productID/add-to-cart
Params | Type | Description |
---|---|---|
:productID |
string |
Required |
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
DELETE /products/get/:productID/delete-cart-item
Params | Type | Description |
---|---|---|
:productID |
string |
Required |
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
GET /products/cart-products
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
POST /checkout/payment
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
Form | Type | Description |
---|---|---|
paymentMode |
['online', 'cod'] |
Required |
POST /orders/place-order/:paymentID
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
Params | Type | Description |
---|---|---|
paymentID |
string |
Required |
GET /orders/get
Authorization | Type | Description |
---|---|---|
Headers |
Bearer Token |
Required |
To run this project, you will need to add the following environment variables to your .env file
MONGO_URI
JWT_SECRET
DB
NODE_ENV
PORT
BASE_URL