Posts

Showing posts from June 19, 2018

Database Connection using NODE JS example

Image
Database Connection using NODE JS example In my earlier article, you have learned how to create your first node js application and how to create node js web application. If you have not read it, I am suggesting you to read these two articles. Below are the link of these articles. http://java.gunustories.com/2018/06/create-first-node-js-application.html http://java.gunustories.com/2018/06/generate-node-js-web-application.html After creating a web application, you need to deal with database. So before writing node js script, you need to download and install MongoDB in your PC. To download MongoDB go to the https://www.mongodb.com/download-center?jmp=nav#community link. Before start writing node js database connection, please insure that MongoDB is running in your PC. Now  open app.js file and write below configuration to connect with MongoDB. const MongoClient = require('mongodb').MongoClient var db MongoClient.connect('mongodb://localhost:27017/', (er

Recent Post

Recent Posts Widget