First, we need to include a few packages for our Nodejs application.
npm install express --save
Express allows us to set up middlewares to respond to HTTP Requests.
npm install body-parser --save
If you want to read HTTP POST data , you have to use the “body-parser” node module.
npm install mongoose --save
Mongoose is an object document modeling (ODM) layer which sits on the top of Node’s MongoDB driver.
app.js This is the main executable application file
Start the MongoDB.
Run app.js file
Go to the browser and open http://127.0.0.1:3000/
Fill the above form
This will add a record named “David Smith” in MongoDB.
Let’s have a check in MongoDB for the same record.
The record is now saved in the “gfg” database in “details” collection.
- Signup form using PHP and MySQL Database
- Amazon auto signup script
- NodeJs CRUD Operations Using Mongoose and MongoDB Atlas
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs - Connect MongoDB with Node app using MongooseJS
- Login form using Node.js and MongoDB
- Nodejs | authentication using Passportjs and passport-local-mongoose
- Cowsay in Nodejs using Requests library
- Nodejs | Web Crawling using Cheerio
- Generating Lighthouse Scores using NodeJS
- Difference between NodeJS and AngularJS
- 7 Famous Apps Built on NodeJS: Reasons and Benefits
- Which One is Most Demanding Back-End Web Framework between Laravel , NodeJS and Django ?
- Difference between Reactjs and Nodejs
- Upload and Retrieve Image on MongoDB using Mongoose
- How to update single and multiple documents in MongoDB using Node.js ?
- How to fetch single and multiple documents from MongoDb using Node.js ?
- Web-Socket in NodeJS
- Dockerizing a simple Nodejs app
- Nodejs | DNS
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : latikesh2121