Refactor status API to return JSON object with status 'ok'

This commit is contained in:
Simon Larsen 2024-04-24 18:00:35 +01:00
parent bf8d4757b1
commit f601e93101
No known key found for this signature in database
GPG Key ID: AB45983AA9C81CDE

View File

@ -26,7 +26,9 @@ export default class StatusAPI {
// General status
router.get('/status', (req: ExpressRequest, res: ExpressResponse) => {
Response.sendEmptyResponse(req, res);
Response.sendJsonObjectResponse(req, res, {
status: 'ok',
});
});
//Healthy probe
@ -36,7 +38,9 @@ export default class StatusAPI {
try {
logger.info('Ready check');
await options.readyCheck();
Response.sendEmptyResponse(req, res);
Response.sendJsonObjectResponse(req, res, {
status: 'ok',
});
} catch (e) {
Response.sendErrorResponse(
req,
@ -54,7 +58,9 @@ export default class StatusAPI {
try {
logger.info('Live check');
await options.readyCheck();
Response.sendEmptyResponse(req, res);
Response.sendJsonObjectResponse(req, res, {
status: 'ok',
});
} catch (e) {
Response.sendErrorResponse(
req,