apps/gateway/src/routes/health.ts
Metadata
- Purpose: Gateway HTTP route handlers and request/response behavior.
- Domain:
applications - Language:
ts - Bytes: 1148
- Lines: 46
- Content hash (short):
6157ab94 - Source (start): apps/gateway/src/routes/health.ts:1
- Source (end): apps/gateway/src/routes/health.ts:46
Indexed Symbols
getHealthPayload(line 6, const arrow function) - Implements get health payload for HTTP request handling.
Markdown Headings (if applicable)
No markdown headings detected.
Source Preview
import type { FastifyPluginAsync } from "fastify";
import { query } from "../services/postgres.js";
import { env } from "../config/env.js";
export const healthRoutes: FastifyPluginAsync = async (app) => {
const getHealthPayload = async () => {
let database = "unknown";
try {
await query("select 1");
database = "ok";
} catch {
database = "error";
}
return {
status: "ok",
service: "anchor-gateway",
dependencies: {
database
},
version: env.engineSku,
environment: env.nodeEnv,
timestamp: new Date().toISOString()
};
};