Created
April 5, 2020 16:27
-
-
Save binyamin/51522a28c8458e7838a111a0e20857a4 to your computer and use it in GitHub Desktop.
Mongo DB Utils
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mongoClient = require('mongodb'); | |
const url = 'mongodb://localhost:27017'; | |
var _db; | |
module.exports = { | |
connectToServer: function(cb) { | |
mongoClient.connect(url, { useNewUrlParser: true }, function(err, client) { | |
_db = client.db('taskit'); | |
return cb(err); | |
}) | |
}, | |
getDb: function() { | |
return _db; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment