add error logger

This commit is contained in:
william Murphy 2019-12-25 15:48:09 -06:00
parent 8528674539
commit ca0342f4e0

View file

@ -57,6 +57,12 @@ app.use('/u', cors(), routes.user)
app.use('/f', express.static('public/files')) app.use('/f', express.static('public/files'))
app.use('/web', express.static('web/dist')) 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 }) client.connect({ useNewUrlParser: true })
.then(() => { .then(() => {
console.log('Connected successfully to db') console.log('Connected successfully to db')