Created
February 18, 2019 11:55
-
-
Save tarusharora/0fdeba403e285be1c547084d1ca76bcc to your computer and use it in GitHub Desktop.
mongoDB connector using mongoose
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 mongoose = require('mongoose'); | |
const connectMongo = (mongoURI) => { | |
mongoose.connect(mongoURI, { useNewUrlParser: true }); | |
mongoose.connection.on('error', (err) => { | |
console.log(err); | |
process.exit(); | |
}); | |
}; | |
module.exports = { | |
connectMongo, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment