First, ensure you have installed mongodb and express via npm. Then, in a file conventionally titled db.js, use the following code:
var MongoClient = require('mongodb').MongoClient
var state = {
db: null,
}
exports.connect = function(url, done) {
if (state.db) return done()
M...