Simple demonstration of Creating , Reading, Updating and Deleting Api data from MongoDb
- npm/nodejs latest version
- REST Client Extension for Visual Studio OR POSTMAN
- Nodejs
- ExpressJs
- MongoDb
- Rest Client
npm install --save
Dependencies are:
express, cors, nodemon, mongoose, dotenv, helmet
npm run start
Or
nodemon app.js
###
// Find all posts
GET http://localhost:4000/post
Content-Type: application/json
// Find post by Id
###
GET http://localhost:4000/post/:id
Content-Type: application/json
// Find post by title
###
GET http://localhost:4000/post/title/:title
Content-Type: application/json
###
###
// create post
POST http://localhost:4000/post
Content-Type: application/json
{
"title": "CRUD",
"description": "Performing a CRUD operation using Nodejs, ExressJs and MongoDb"
}
###
// update post
###
PUT http://localhost:4000/post/:id
Content-Type: application/json
{
"title": "CRUD Operations",
"description": "Designing Api's using NodeJs, ExpressJs and MongoDb"
}
###
// delete post
###
DELETE http://localhost:4000/post/:id
Content-Type: application/json