| 1 | import { createFileRoute } from "@tanstack/react-router"; |
| 2 | import { checkDatabaseReady } from "../../prisma/queries"; |
| 3 | |
| 4 | export const Route = createFileRoute("/api/health")({ |
| 5 | server: { |
| 6 | handlers: { |
| 7 | GET: async () => { |
| 8 | await checkDatabaseReady(); |
| 9 | const configurationReady = |
| 10 | process.env.TANSTACK_SHARED_FLAG === "project-level"; |
| 11 | return Response.json( |
| 12 | { |
| 13 | ok: configurationReady, |
| 14 | database: "ready", |
| 15 | configuration: configurationReady ? "ready" : "unavailable", |
| 16 | }, |
| 17 | { status: configurationReady ? 200 : 503 }, |
| 18 | ); |
| 19 | }, |
| 20 | }, |
| 21 | }, |
| 22 | }); |