VOOZH about

URL: https://www.geeksforgeeks.org/node-js/signup-form-using-node-js-and-mongodb/

⇱ Signup Form Using Node.js and MongoDB - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Signup Form Using Node.js and MongoDB

Last Updated : 27 Feb, 2026

Signup Form using Node.js and MongoDB allows users to register by storing their details securely in a MongoDB database. It connects the frontend form with a Node.js backend to handle validation and data storage.

Installations

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

To read HTTP POST data , you have to use the "body-parser" node module.

npm install mongoose --save

Mongoose is an object document mapping (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:

node app.js

Go to the browser and open http://127.0.0.1:3000/

👁 Image

Fill the above form

👁 Image

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.

👁 Image
Comment
Article Tags:
Article Tags:

Explore