Skip to content

amitgpt/express-mongodb-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

express-mongodb-example

RESTful API with Node.js, Express.js, Mongoose and MongoDB.

Example of a RESTful API built with Node.js, Express.js, Mongoose and MongoDB.

RESTful API endpoints

GET /api/products

Get all items.

  • Method: GET
  • URL: /api/products

POST /api/products

Create a new products.

  • Method: POST
  • URL: /api/products
  • Body:

{ "title":"Product_Name", "price":"500", "instock":"true", "photo":"null" }

GET /api/products/:products

Get item with specific id.

  • Method: GET
  • URL: /api/products/product_id

PUT /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 /api/product/:product_id

Delete item with specific id.

  • Method: DELETE
  • URL: /api/product/product_id

Install

npm install

Run

  1. Make sure MongoDB is running.
  2. nodemon index.js

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published