This full E-Commerce API build using Express and Mongo. Here it contains all the required functionalities of a full-fledged E-commerce API like User registration, User Login, Category Add, Edit & Delete, Product Add, Edit, Delete, Add product feature image & Add product images, Order creation and etc...
$ cd nodejs-ecommerce-api
$ npm install
- Duplicate and database.configexample.js as database.confi.js and fill in environment variables
$ nodemon app.js
POST | /api/v1/users/register
Key | Value |
---|---|
name | Admin |
[email protected] | |
password | password |
phone | +947187520 |
isAdmin | true |
street | Main Street |
apartment | Block C |
zip | 10870 |
city | Colombo |
country | SriLanka |
POST | /api/v1/users/login
Key | Value |
---|---|
[email protected] | |
password | password |
GET | /api/v1/users
GET | /api/v1/users/{id}
DELETE | /api/v1/users/{id}
GET | /api/v1/users/get/count
POST | /api/v1/categories
Key | Value |
---|---|
name | Category 1 |
icon | icon-health |
color | #55879 |
GET | /api/v1/categories
GET | /api/v1/categories/{id}
PUT | /api/v1/categories/{id}
Key | Value |
---|---|
name | Category 1 |
icon | icon-health |
color | #55879 |
DELETE | /api/v1/categories/{id}
POST | /api/v1/products
Key | Value |
---|---|
name | Product 1 |
description | Description |
richDescription | Rich Description |
image | image |
brand | Brand 1 |
price | 50 |
category | {category_id} |
countInStock | 100 |
rating | 4.5 |
numReviews | 40 |
isFeatured | true |
GET | /api/v1/products
GET | /api/v1/products/{id}
GET | /api/v1/products/get/count
GET | /api/v1/products/get/featured/{count}
POST | /api/v1/products/gallery-images/{id}
Key | Value |
---|---|
images | Array of images |
PUT | /api/v1/products
Key | Value |
---|---|
name | Product 1 |
description | Description |
richDescription | Rich Description |
image | image |
brand | Brand 1 |
price | 50 |
category | {category_id} |
countInStock | 100 |
rating | 4.5 |
numReviews | 40 |
isFeatured | true |
DELETE | /api/v1/products/{id}
POST | /api/v1/orders
{
"orderItems":[
{
"quantity": 3,
"product" : "602e9c348e700335d8532b14"
},
{
"quantity": 2,
"product" : "602bde0161fcc409fc149734"
}
],
"shippingAddress1" : "No 45,Park Street",
"shippingAddress2" : "No 46,Main Street",
"city" : "Colombo",
"zip" : "10600t",
"country" : "Sri Lanka",
"phone" : "+94717185748",
"user" : "602e9b718e700335d8532b13"
}
GET | /api/v1/orders
GET | /api/v1/orders/{id}
GET | /api/v1/orders/get/count
GET | /api/v1/orders/get/totalsales
GET | /api/v1/orders/get/usersorders/{userid}
PUT | /api/v1/orders/{id}
DELETE | /api/v1/orders/{id}