Zum Inhalt springen
ZVVAtlas · Showcase

Command Palette

Schnell durch Atlas navigieren

Health Status

Atlas-Pflicht: jede ZVV-App exponiert /api/health. Cockpit + Statuspage pollen den Endpoint. Hier ist die Live-Response dieser Demo-App.

Live Response

/api/health
Mindestens ein Check rotHTTP 0
Timestamp:
JSON-Responsejson
{
  "error": "fetch failed"
}

Atlas-Pflicht: /api/health

Jede ZVV-App hat einen /api/health-Endpoint. Cockpit (cockpit.zvv.dev) und Statuspage pollen ihn periodisch. Status 200 = ok, 503 = degraded.

app/api/health/route.tstsx
// app/api/health/route.ts
export const dynamic = 'force-dynamic'

export async function GET() {
  const checks = await Promise.allSettled([
    checkDatabase(),
    checkMailer(),
  ])

  const ok = checks.every((c) => c.status === 'fulfilled' && c.value.ok)
  return Response.json({
    ok,
    ts: new Date().toISOString(),
    version: process.env.NEXT_PUBLIC_APP_VERSION,
    commit: process.env.NEXT_PUBLIC_GIT_COMMIT,
    checks: checks.map((c, i) => ({
      name: ['database', 'mailer'][i],
      ok: c.status === 'fulfilled' && c.value.ok,
      error: c.status === 'rejected' ? String(c.reason) : null,
    })),
  }, { status: ok ? 200 : 503 })
}

Was niemals in /health

  • – Geheimnisse oder API-Keys
  • – User-Daten oder PII
  • – Komplette Stack-Traces (nur Error-Summary)