specialpages: New /health endpoint for health checking

This endpoint is intended to conform with:
https://www.ietf.org/archive/id/draft-inadarei-api-health-check-06.html
This commit is contained in:
Richard Hansen 2021-12-20 20:34:43 -05:00
parent 2e4c546c7f
commit 696f9c3367
3 changed files with 68 additions and 0 deletions

View file

@ -11,6 +11,16 @@ const util = require('util');
const webaccess = require('./webaccess');
exports.expressPreSession = async (hookName, {app}) => {
// This endpoint is intended to conform to:
// https://www.ietf.org/archive/id/draft-inadarei-api-health-check-06.html
app.get('/health', (req, res) => {
res.set('Content-Type', 'application/health+json');
res.json({
status: 'pass',
releaseId: settings.getEpVersion(),
});
});
app.get('/stats', (req, res) => {
res.json(require('../../stats').toJSON());
});