// app/api/health/route.js import { NextResponse } from "next/server"; import { getDb } from "@/lib/db"; import fs from "fs/promises"; export async function GET() { const result = { db: null, nas: null, }; // DB-Check try { const db = await getDb(); await db.command({ ping: 1 }); result.db = "ok"; } catch (error) { result.db = `error: ${error.message}`; } // NAS-Check const nasPath = process.env.NAS_ROOT_PATH || "/mnt/niederlassungen"; try { const entries = await fs.readdir(nasPath); result.nas = { path: nasPath, entriesSample: entries.slice(0, 5), }; } catch (error) { // Lokal auf dem Mac ist der Pfad wahrscheinlich leer oder existiert nicht → Fehler ist ok result.nas = `error: ${error.message}`; } return NextResponse.json(result); }