1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-11-30 14:31:42 -05:00

Add uncaught exception handler

This commit is contained in:
Jack Foltz 2018-07-29 19:35:58 -04:00
parent b8c87c1b89
commit c851d1d808
Signed by: foltik
GPG Key ID: 303F88F996E95541

View File

@ -11,12 +11,17 @@ const helmet = require('helmet');
const app = express();
const config = require('config');
process.on('uncaughtException', function (err) {
console.log('FATAL UNCAUGHT EXCEPTION:');
console.log(err.stack);
});
// MongoDB
const dbHost = config.get('Database.host');
let db;
mongoose.connect(dbHost, {useNewUrlParser: true})
.then(() => {
console.log('Connected to database ' + dbHost);
console.log('Connected to database ' + dbHost + '\n');
db = mongoose.connection;
});