oneuptime/CommonServer/API/StatusAPI.ts
Simon Larsen 0f5b40fff4
fix route
2022-12-30 13:03:01 +00:00

30 lines
773 B
TypeScript

import Express, {
ExpressRequest,
ExpressResponse,
ExpressRouter,
} from '../Utils/Express';
import LocalCache from '../Infrastructure/LocalCache';
const router: ExpressRouter = Express.getRouter();
router.get('/app-name', (_req: ExpressRequest, res: ExpressResponse) => {
res.send({ app: LocalCache.getString('app', 'name') });
});
// General status
router.get('/status', (_req: ExpressRequest, res: ExpressResponse) => {
res.send({ status: 'ok' });
});
//Healthy probe
router.get('/status/healthy', (_req: ExpressRequest, res: ExpressResponse) => {
res.send({ status: 'healthy' });
});
//Liveness probe
router.get('/status/live', (_req: ExpressRequest, res: ExpressResponse) => {
res.send({ status: 'live' });
});
export default router;