
1// GET /health - called by the load balancer and uptime monitor2app.get('/health', async (req, res) => {3 const checks = {4 db: await db.ping().then(() => 'ok').catch(() => 'fail'),5 redis: (await redis.isReady()) ? 'ok' : 'fail',6 };78 const healthy = Object.values(checks).every((v) => v === 'ok');9 res.status(healthy ? 200 : 503).json({10 status: healthy ? 'ok' : 'degraded',11 checks,12 version: process.env.GIT_SHA,13 });14});