In apps.js
var mongo = require('mongodb');
var monk = require('monk');
var db = monk('localhost:27017/ta');
module.exports = db;
In /lib/mylib.js
var db = require('../apps.js')
Though i would reccommend making a separate file called db.js and in that file export the connection ,that is more cleaner.
In apps.js
var mongo = require('mongodb');
var monk = require('monk');
var db = monk('localhost:27017/ta');
module.exports = db;
In /lib/mylib.js
var db = require('../apps.js')
Though i would reccommend making a separate file called db.js and in that file export the connection ,that is more cleaner.