import type { APIRoute } from 'astro'; import { loadNasConfig, testNas } from '../../../lib/nas'; export const prerender = false; const json = (b: unknown, s = 200) => new Response(JSON.stringify(b), { status: s, headers: { 'Content-Type': 'application/json' } }); export const POST: APIRoute = async () => { const cfg = await loadNasConfig(); if (!cfg) return json({ ok: false, message: 'NAS nicht vollständig konfiguriert (oder deaktiviert).' }); return json(await testNas(cfg)); };