15 lines
426 B
JavaScript
15 lines
426 B
JavaScript
|
|
/**
|
||
|
|
* routes/health.mjs — Health check endpoint
|
||
|
|
*/
|
||
|
|
|
||
|
|
export default function registerHealth(app, pool, PORT) {
|
||
|
|
app.get('/health', async (_req, res) => {
|
||
|
|
try {
|
||
|
|
await pool.query('SELECT 1');
|
||
|
|
res.json({ ok: true, service: 'aamos-ledger', port: PORT, db: 'connected' });
|
||
|
|
} catch (e) {
|
||
|
|
res.status(503).json({ ok: false, service: 'aamos-ledger', db: 'disconnected', error: e.message });
|
||
|
|
}
|
||
|
|
});
|
||
|
|
}
|