Skip to content

Commit

Permalink
Merge pull request #26 from digital-land/healthCheck
Browse files Browse the repository at this point in the history
Health check
  • Loading branch information
GeorgeGoodall authored Dec 4, 2023
2 parents f835041 + 736e86c commit da34a6c
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand All @@ -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 })
Expand Down

0 comments on commit da34a6c

Please sign in to comment.