14 lines
849 B
TypeScript
14 lines
849 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { db } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export async function GET(request: Request) {
|
|
const probe = new URL(request.url).searchParams.get("probe");
|
|
if (probe === "live") return NextResponse.json({ ok: true, status: "live", version: process.env.APP_VERSION || "development", timestamp: new Date().toISOString() });
|
|
try {
|
|
db.prepare("SELECT 1").get();
|
|
const failedJobs = Number((db.prepare("SELECT count(*) AS count FROM sync_jobs WHERE status='failed'").get() as { count: number }).count);
|
|
return NextResponse.json({ ok: true, status: "ready", version: process.env.APP_VERSION || "development", database: "ok", failedJobs, timestamp: new Date().toISOString() });
|
|
} catch { return NextResponse.json({ ok: false, database: "error" }, { status: 503 }); }
|
|
}
|