diff options
author | Mateja <mail@matejamaric.com> | 2021-06-02 23:31:16 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-06-02 23:31:21 +0200 |
commit | e06e6a8348883c925a314f6181546a92c3253769 (patch) | |
tree | f3474989ef8e5903dec25301685845c9c6176a8c | |
parent | b152602c92ca6ee361f478ecf2da34a9446e4f97 (diff) | |
download | node-playground-e06e6a8348883c925a314f6181546a92c3253769.tar.gz node-playground-e06e6a8348883c925a314f6181546a92c3253769.zip |
Logging DB connection.
-rw-r--r-- | index.js | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -5,10 +5,9 @@ const session = require('express-session'); const MongoSessionStore = require('connect-mongo'); const flash = require('connect-flash'); const passport = require('passport'); -const {port, mongoUrl, masterKey} = require("./config/env") +const {port, mongoUrl, masterKey} = require("./config/env") const oldForm = require('./utils/middleware/oldForm'); - const webRoutes = require('./routes/web'); const app = express(); @@ -19,6 +18,9 @@ mongoose.connect(mongoUrl, { useFindAndModify: false }); +mongoose.connection.on('error', console.error.bind(console, 'connection error:')); +mongoose.connection.once('open', () => console.log("Successfully connected to MongoDB!")); + app.use(session({ secret: masterKey, resave: false, |