DEV Community

Cover image for MongoDB setup for creating REST API
Kritika Srivastava
Kritika Srivastava

Posted on

9 2

MongoDB setup for creating REST API

Here I am going to explain how to set up your database MongoDB for creating REST API using node.js,express which you can later fetch using any frontend like React.I am not covering the basics of mongoDB here.

Steps to be followed:

  1. Go to MongoDB website mongoDB and create your free account by signing up or signing in using your Google account. Alt Text

Alt Text

Alt Text

2.Create a cluster.
Alt Text
Choose Shared Clusters which is free.
Alt Text
Now you can choose AWS and North Virginia region which mostly people use and then click on Create Cluster at the bottom.
Alt Text
It will take few minutes in cluster creation.
Alt Text

3.Now create user.
Alt Text
Authenticate the user by giving username,password and choosing Database user privileges-Read and write to any database.
Alt Text

4.Now go to Network access and whitelist your IP Address.
Alt Text
Choose your current IP address and confirm.

Alt Text
You will only be able to connect to your cluster from the list of IP Addresses in IP Access List.

5.Now go to Clusters and choose Connect.
Alt Text
Now connect your application.
Alt Text
Now copy the link which you will use in your project.Replace the password in the link with the actual password you set before.
Alt Text

Now you can use this link to connect to database in your REST API or MERN stack if you work in React or any other frontend.

Happy Learning :)
You can follow me on Twitter and Github.

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (1)

Collapse
 
kritika27 profile image
Kritika Srivastava

Thanks Michael :)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay