feat: healthz endpoint

This commit is contained in:
Nick 2019-05-12 13:15:23 -04:00
parent 6041b1697a
commit 9f87535a03

View File

@ -17,6 +17,17 @@ router.get('/robots.txt', (req, res, next) => {
}
})
/**
* Health Endpoint
*/
router.get('/healthz', (req, res, next) => {
if (WIKI.models.knex.client.pool.numFree() < 1 && WIKI.models.knex.client.pool.numUsed() < 1) {
res.status(503).json({ ok: false }).end()
} else {
res.status(200).json({ ok: true }).end()
}
})
/**
* Create/Edit document
*/