Connect MongoDB With Express JS


In this blog, you will learn How to connect MongoDB with Express Js which is a Node Js framework to make REST APIs.

1. Installing Mongoose

To install mongoose use this command "npm i mongoose" and import it in the index.js file.
After installing and importing mongoose we will now connect to the Database


The above code will connect MongoDB and express and now you can use the database. After running this file using the "node index" command it will show the message that the database is connected.

Result

If you liked this blog and want video tutorials do Subscribe to our YouTube channel here.

Post a Comment

0 Comments