← back to Omega Watches 2

src/app/api/health/route.ts

21 lines

import { NextResponse } from "next/server";
import { healthCheck } from "@/lib/db";

export const dynamic = "force-dynamic";

export async function GET() {
  const db = await healthCheck();
  const uptime = process.uptime();

  return NextResponse.json({
    success: true,
    data: {
      status: db.ok ? "healthy" : "degraded",
      version: "2.0.0",
      uptime_seconds: Math.round(uptime),
      database: db,
      timestamp: new Date().toISOString(),
    },
  });
}