12 lines
584 B
TypeScript
12 lines
584 B
TypeScript
import { NextResponse } from "next/server";
|
|
import { db } from "@/lib/db";
|
|
|
|
export const dynamic = "force-dynamic";
|
|
export async function GET() {
|
|
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, version: process.env.APP_VERSION || "development", database: "ok", failedJobs, timestamp: new Date().toISOString() });
|
|
} catch { return NextResponse.json({ ok: false, database: "error" }, { status: 503 }); }
|
|
}
|