Browse Source

feat: healthz endpoint

pull/835/head
Nick 5 years ago
parent
commit
9f87535a03
1 changed files with 11 additions and 0 deletions
  1. 11
      server/controllers/common.js

11
server/controllers/common.js

@ -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 * Create/Edit document
*/ */

Loading…
Cancel
Save