Example of a RESTful API built with Node.js, Express.js, Mongoose and MongoDB.
Get all items.
- Method:
GET
- URL:
/api/products
Create a new products.
- Method:
POST
- URL:
/api/products
- Body:
{ "title":"Product_Name", "price":"500", "instock":"true", "photo":"null" }
Get item with specific id.
- Method:
GET
- URL:
/api/products/product_id
Update entire item with specific id.
- Method:
PUT
- URL:
/api/products/product_id
- Body:
{ "title":"Product_Name", "price":"500", "instock":"true", "photo":"null" }
Delete item with specific id.
- Method:
DELETE
- URL:
/api/product/product_id
npm install
- Make sure MongoDB is running.
nodemon index.js