-
-
Save amandeepmittal/ca7ee2866245cc98d1407b5d5a3a2563 to your computer and use it in GitHub Desktop.
This file contains 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
import mongoose from 'mongoose'; | |
import config from './index'; | |
const URI = config.mongoURI; | |
mongoose.connect(URI); | |
// When successfully connected | |
mongoose.connection.on('connected', () => { | |
console.log('Established Mongoose Default Connection'); | |
}); | |
// When connection throws an error | |
mongoose.connection.on('error', err => { | |
console.log('Mongoose Default Connection Error : ' + err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment