2035f73e7d
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
724 B
TypeScript
24 lines
724 B
TypeScript
import { connection } from "next/server";
|
||
import { pingDb } from "@/lib/db/mongo";
|
||
import { APP_COMMIT, APP_VERSION } from "@/lib/version";
|
||
|
||
/**
|
||
* Sağlık kontrolü (Dokploy / Docker HEALTHCHECK). Veritabanına erişilemezse 503.
|
||
* İç hata detayı döndürülmez.
|
||
*/
|
||
export async function GET() {
|
||
// Cache Components açıkken GET handler'ı build'de prerender edilmesin.
|
||
await connection();
|
||
const dbOk = await pingDb();
|
||
return Response.json(
|
||
{
|
||
status: dbOk ? "ok" : "degraded",
|
||
db: dbOk ? "ok" : "unreachable",
|
||
version: APP_VERSION,
|
||
commit: APP_COMMIT,
|
||
time: new Date().toISOString(),
|
||
},
|
||
{ status: dbOk ? 200 : 503, headers: { "Cache-Control": "no-store" } },
|
||
);
|
||
}
|