A RESTful API using MongoDB and ExpressJS.
- In your mongoDB create a database called "cantiin"
- run these commands:
npm install
npm start
There are 2 Schemas.
_id
- This is the id to access any product
name
- Type: String
required
: trueMinimum Length
: 3 lettersMaximum Length
: 200 letters
price
- Type: Number
required
: trueMinimum Value
: .01Maximum Value
: 1000000
description
- Type: String
required
: trueMinimum Length
: 5 lettersMaximum Length
: 1000 letters
_id
- This is the id to access any product
product_id
- Type: ObjectId (Relationship with Product)
- The ID of the Product related to this order
- The product must exist in the database
amount
- Type: Number
required
: trueMinimum Value
: .01Maximum Value
: 1000000
This endpoint will display Hello World
.
This endpoint is created only to make sure that the project is working.
B-1) (GET) http://127.0.0.1:3000/products/
This endpoint will display a list of the products in the database.
They will be displayed as JSON.
B-2) (POST) http://127.0.0.1:3000/products/
This endpoint will add a new product.
B-3) (GET) http://127.0.0.1:3000/products/:id
This endpoint will display the product with this id.
B-4) (DELETE) http://127.0.0.1:3000/products/:id
To delete the product with this ID.
B-5) (PUT) http://127.0.0.1:3000/products/:id
To update the product with this ID.