Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const {MongoClient} = require('mongodb');
- const {dbUrl, dbPort, dbName} = require('dbconfig');
- // 'mongodb://localhost:27017/AppDatabase'
- const connectionUrl = `mongodb://${dbUrl}:${dbPort}/${dbName}`;
- MongoClient.connect(connectionUrl, (err, res) => {
- if(err){
- return console.log('Unable to connect to mongodb server');
- }
- console.log('Connected to mongodb Server');
- // Close connection
- db.close();
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement