It is an API which is made for the Backend Internship.
Server: NodeJS, ExpressJS
DataBase: MongoDB
Clone the project
git clone https://github.com/mohitranjan256/E-Commerce-API.gitGo to the project directory
cd E-Commerce-APIInstall dependencies
npm installStart the server
npm startIt is running on the localhost machine on PORT = 5000.
http://localhost:5000 GET /products GET /products/:id| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. id of product to fetch |
POST /products| Parameter | Type | Description |
|---|---|---|
name |
string |
Required. name of the product |
description |
string |
Required. description of product |
price |
number |
Required. price of product |
PUT /products/:id| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. id of product to update |
name |
string |
name of the product to update |
description |
string |
description of product to update |
price |
number |
price of product to update |
DELETE /products/:id| Parameter | Type | Description |
|---|---|---|
id |
string |
Required. id of product to delete |
GET /products/:prid/var GET /products/:prid/var/:varid| Parameter | Type | Description |
|---|---|---|
prid |
string |
Required. id of product to fetch |
varid |
string |
Required. id of variant to fetch |
POST /products/:prid/var| Parameter | Type | Description |
|---|---|---|
prid |
string |
Required. id of product |
name |
string |
name of the variant |
sku |
string |
description of variant |
additionalcost |
string |
price of variant |
stockcount |
number |
price of variant |
PUT /products/:prid/var/:varid| Parameter | Type | Description |
|---|---|---|
prid |
string |
Required. id of product to update |
varid |
string |
Required. id of variant to update |
name |
string |
name of the variant |
sku |
string |
description of variant |
additionalcost |
string |
price of variant |
stockcount |
number |
price of variant |
DELETE /products/:prid/var/:varid| Parameter | Type | Description |
|---|---|---|
prid |
string |
Required. id of product to delete |
varid |
string |
Required. id of variant to delete |
GET /search?q=name| Parameter | Type | Description |
|---|---|---|
name |
string |
Required.name is required name either can be Product name , product description or product variant name |

