Feat: refactor routes.js express entrypoint config

Feat: express config script refactor

Feat: add state and settingsCache files
This commit is contained in:
Cesar 2021-01-08 16:08:31 +00:00 committed by Josh Harvey
parent c3f8f98c26
commit 85235eaa13
22 changed files with 807 additions and 1 deletions

View file

@ -0,0 +1,15 @@
const logger = require('../logger')
function errorHandler (err, req, res, next) {
const statusCode = err.name === 'HTTPError'
? err.code || 500
: 500
const json = { error: err.message }
if (statusCode >= 400) logger.error(err)
return res.status(statusCode).json(json)
}
module.exports = errorHandler