venmjs
Version:
This is a tool 🔧 that can be installed in your terminal at any time ⛏️ it was made for beginners and even for experts, for his utilities, and for a simple creation process 🧨. Every web developer knows how frustrating is to deal with the creation of a ne
21 lines (17 loc) • 423 B
JavaScript
const mongoose = require('mongoose');
const init = () => {
mongoose
.connect(process.env.DB_URL, {
useNewUrlParser: true,
useUnifiedTopology: true,
})
.catch((err) => {
console.error('error: ' + err.stack);
process.exit(1);
});
mongoose.connection.on('open', () => {
console.log('connected to database');
});
};
mongoose.Promise = global.Promise;
module.exports = init;