blob: 93f55580bd5436f4b2bf1feff432cef1044c37dd [file] [log] [blame]
Cleo00ccf362024-02-29 15:07:31 -05001const mongoose = require('mongoose');
2
3module.exports = {
4 init: () => {
5 mongoose.connect(process.env.MONGO_URL).catch(err => console.log(err.reason));
6
7 mongoose.Promise = global.Promise;
8
9 mongoose.connection.on('connected', () => {
10 console.log('\nMongoose connection successfully opened');
11 });
12
13 mongoose.connection.on('err', err => {
14 console.error(`Mongoose connection Error\n ${err.stack}`);
15 });
16
17 mongoose.connection.on('disconnected', () => {
18 console.log('Mongoose connection disconnected');
19 });
20 }
21};