Skip to content

manish0502/Node.js-Express-MongoDb-Build-a-CRUD-Rest-Api-for-beginners

Repository files navigation

Node.js-Express-MongoDb-Build-a-CRUD-Rest-Api-for-beginners

#Guide for beginner #Mongodb connection #CRUD #Api Development #express generator

  • npm install mongoose
  • npx express-generator
  1. download it
  2. npm i
  3. nodemon start
  4. use postman to test
  5. http://localhost:3000

CRUD is an acronym for Create, Read, Update and Delete. It is a set of operations we get servers to execute (POST, GET, PUT and DELETE requests respectively). This is what each operation does:

Create (POST) - Make something
Read (GET)- Get something
Update (PUT) - Change something
Delete (DELETE)- Remove something

Restful API:

  • A RESTful API is an application program interface that uses HTTP requests to GET, PUT, POST and DELETE data. We will be using an API to define when we add data to our database and when we read from the database. An endpoint is a route that our server will be listening to to get data from the browser.

  • We already have one route that we have created already in the application and that is the route that is listening at the endpoint “/” which is the homepage of our application.

  • Mongoose: Mongoose is a MongoDB object modeling tool designed to work in an asynchronous environment.

Node.js is used in conjunction with NoSQL databases to build a lot of modern days web applications. Some of the common databases used are MySQL and MongoDB. One of the common modules used for working with MongoDB databases is a module called 'MongoDB.' This module is installed via the Node package manager. With the MongoDB module, it's possible to query for records in a collection and perform the normal update, delete and insert operations. Finally, one of the modern practices is to use the express framework along with MongoDB to deliver modern-day applications. The Express framework can make use of the data returned by the MongoDB driver and display the data to the user in the web page accordingly.

About

#Guide for beginner #Mongodb connection #CRUD #Api Development

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published