[Solved] How can i get result from export module using async/await
Return a promise from your config.js file. mongodb client supports promises directly, just do not pass the callback parameter and use then. config.js module.exports = (app) => { const mongo_client = require(‘mongodb’).MongoClient; const assert = require(‘assert’); const url=”mongodb://localhost:27017″; const db_name=”portfolio”; return mongo_client.connect(url).then(client => { assert.equal(null, err); console.log(‘Connection Successfully to Mongo’); return client.db(db_name); }); }; And … Read more