Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
March 3, 2021 08:49 am GMT

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.


Original Link: https://dev.to/kritika27/mongodb-setup-for-creating-rest-api-1d14

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To