blob: 93f55580bd5436f4b2bf1feff432cef1044c37dd [file] [log] [blame]
const mongoose = require('mongoose');
module.exports = {
init: () => {
mongoose.connect(process.env.MONGO_URL).catch(err => console.log(err.reason));
mongoose.Promise = global.Promise;
mongoose.connection.on('connected', () => {
console.log('\nMongoose connection successfully opened');
});
mongoose.connection.on('err', err => {
console.error(`Mongoose connection Error\n ${err.stack}`);
});
mongoose.connection.on('disconnected', () => {
console.log('Mongoose connection disconnected');
});
}
};