| 1234567891011121314151617181920212223242526 |
- // app/api/branches/route.js
- import { NextResponse } from "next/server";
- import { listBranches } from "@/lib/storage";
- /**
- * GET /api/branches
- *
- * Returns the list of branches (e.g. ["NL01", "NL02", ...]) based on the
- * directory names under NAS_ROOT_PATH.
- */
- export async function GET() {
- try {
- const branches = await listBranches();
- return NextResponse.json({ branches });
- } catch (error) {
- // Log the full error on the server for debugging
- console.error("[api/branches] Error reading branches:", error);
- // Return a generic error message to the client
- return NextResponse.json(
- { error: "Fehler beim Lesen der Niederlassungen" },
- { status: 500 }
- );
- }
- }
|