A RESTful API in NodeJS for a simple shop app.
Connect to MongoDB. Copy connection URL.
To run this project, you will need to add the following environment variables to your nodemon.json file
{
"env": {
"MONGO_ATLAS_URI": "",
"JWT_KEY": ""
}
}
Paste the connection URL in MONGO_ATLAS_URI field and use a random string as JWT_KEY.
Clone the project
git clone https://github.com/Shreyas582/node-restful-api
Go to the project directory
cd node-restful-api
Install dependencies
npm install
Start the server
npm run start
POST /user/signup
{
"email": "",
"password": ""
}
POST /user/login
{
"email": "",
"password": ""
}
DELETE /user/:userID
Parameter | Type | Description |
---|---|---|
userID |
string |
Required. ID of user |
GET /products
POST /products
Form-Data | Type | Description |
---|---|---|
name |
string |
Required. Product name |
price |
string |
Required. Product price |
productImage |
file |
Required. Product image file |
GET /products/:productID
Parameter | Type | Description |
---|---|---|
productID |
string |
Required. ID of product |
PATCH /products/:productID
Parameter | Type | Description |
---|---|---|
productID |
string |
Required. ID of product |
DELETE /products/:productID
Parameter | Type | Description |
---|---|---|
productID |
string |
Required. ID of product |
GET /orders
POST /orders
{
"quantity": <int>,
"productID": ""
}
GET /orders/:orderID
Parameter | Type | Description |
---|---|---|
orderID |
string |
Required. ID of order |
DELETE /orders/:orderID
Parameter | Type | Description |
---|---|---|
orderID |
string |
Required. ID of order |