Add AI DEV Node deployment foundation
This commit is contained in:
38
server/routes/health.ts
Normal file
38
server/routes/health.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { Router } from 'express';
|
||||
import { ok } from '../http/apiResponse.js';
|
||||
import { query } from '../db/pool.js';
|
||||
|
||||
export const healthRouter = Router();
|
||||
|
||||
export const platformStatusRouter = Router();
|
||||
|
||||
healthRouter.get('/health', (_req, res) => {
|
||||
ok(res, {
|
||||
status: 'UP',
|
||||
service: 'acs-node',
|
||||
});
|
||||
});
|
||||
|
||||
platformStatusRouter.get('/healthz', (_req, res) => {
|
||||
res.json({ ok: true });
|
||||
});
|
||||
|
||||
platformStatusRouter.get('/db', async (_req, res) => {
|
||||
try {
|
||||
const result = await query<{ now: Date }>('SELECT now() AS now');
|
||||
res.json({ ok: true, now: result.rows[0]?.now });
|
||||
} catch (error) {
|
||||
res.status(500).json({
|
||||
ok: false,
|
||||
error: error instanceof Error ? error.message : String(error),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
platformStatusRouter.get('/s3', (_req, res) => {
|
||||
res.json({
|
||||
ok: true,
|
||||
skipped: true,
|
||||
reason: 'ACS does not currently use S3/MinIO storage.',
|
||||
});
|
||||
});
|
||||
6
server/routes/index.ts
Normal file
6
server/routes/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Router } from 'express';
|
||||
import { healthRouter } from './health.js';
|
||||
|
||||
export const apiRouter = Router();
|
||||
|
||||
apiRouter.use(healthRouter);
|
||||
Reference in New Issue
Block a user