From ca0342f4e012bc4b2b79000f697bf93b0d2ff536 Mon Sep 17 00:00:00 2001 From: william Murphy Date: Wed, 25 Dec 2019 15:48:09 -0600 Subject: [PATCH] add error logger --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index fef09cf..cb72f4f 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,12 @@ app.use('/u', cors(), routes.user) app.use('/f', express.static('public/files')) app.use('/web', express.static('web/dist')) +// error logging +app.use(function (err, req, res, next) { + console.error(err.message, req.body, err.stack) + res.status(500).send('An error occurred while processing the request') +}) + client.connect({ useNewUrlParser: true }) .then(() => { console.log('Connected successfully to db')