diff --git a/index.js b/index.js index 593e2e01..133b7a97 100644 --- a/index.js +++ b/index.js @@ -63,11 +63,6 @@ app.use(bodyParser.urlencoded({ extended: true })) app.use('/', formWizard) -// file not found handler -app.use((req, res, next) => { - res.status(404).render('file-not-found') -}) - // error handler app.use((err, req, res, next) => { logger.error('Request error', { req, err }) @@ -88,6 +83,16 @@ app.use((err, req, res, next) => { res.status(err.status).render(err.template, { err }) }) +app.get('/health', (req, res) => { + logger.info('healthcheck') + res.status(200).json({ applicationHealth: 'ok' }) +}) + +// file not found handler +app.use((req, res, next) => { + res.status(404).render('file-not-found') +}) + // listen for incomming requests app.listen(config.port, () => { logger.info('App listening on http://localhost::port', { port: config.port })