I wanted to open Database (Mongo) connection only once when I start application and share the same connection across the application. What am doing as part of app.js is
var dbConnection = mongoose.createConnection(config.database.address, config.database.dbName, config.database.port);
passing dbConnection in every route call
require('./services/MasterServices')(app , dbConnection);
Is it right approach or anything wrong here?