We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 55cf4be + 6e44322 commit 2fe2fc2Copy full SHA for 2fe2fc2
src/config/database.config.js
@@ -1,6 +1,27 @@
1
+import debug from 'debug';
2
import mongoose from 'mongoose';
3
-import debug from 'debug';
4
+mongoose.connection.on('connected', () => {
5
+ console.log('MongoDB Connection Established');
6
+});
7
+
8
+mongoose.connection.on('reconnected', () => {
9
+ console.log('MongoDB Connection Reestablished');
10
11
12
+mongoose.connection.on('disconnected', () => {
13
+ console.log('MongoDB Connection Disconnected');
14
15
16
+mongoose.connection.on('close', () => {
17
+ console.log('MongoDB Connection Closed');
18
19
20
+mongoose.connection.on('error', (error) => {
21
+ console.log(`MongoDB ERROR: ${error}`);
22
23
+ process.exit(1);
24
25
26
const DEBUG = debug('dev');
27
0 commit comments