Files
flxn-app/src/app/routes/api/health.ts
T
kyle 4106c3c846 fix(build): keep supertokens server init out of the client module graph
- ensureSuperTokensBackend moved to the health route handler; the dynamic
  imports in exclusions and alerts dragged recipes into the client build
2026-08-26 18:58:31 -07:00

30 lines
916 B
TypeScript

import { createFileRoute } from "@tanstack/react-router";
import { ensureTelemetryScheduler } from "@/lib/telemetry/scheduler.server";
import { getHealthSnapshot } from "@/lib/telemetry/health.server";
import { ensureSuperTokensBackend } from "@/lib/supertokens/server";
export const Route = createFileRoute("/api/health")({
server: {
handlers: {
GET: async () => {
ensureSuperTokensBackend();
ensureTelemetryScheduler();
const snapshot = await getHealthSnapshot();
// Always 200: a dependency outage must not fail the k8s probes.
return new Response(
JSON.stringify({
status: snapshot.status,
checks: snapshot.checks,
timestamp: new Date().toISOString(),
}),
{
status: 200,
headers: { "Content-Type": "application/json" },
}
);
},
},
},
});