route.js 421 B

12345678910111213141516
  1. // app/api/branches/route.js
  2. import { NextResponse } from "next/server";
  3. import { listBranches } from "@/lib/storage";
  4. export async function GET() {
  5. try {
  6. const branches = await listBranches();
  7. return NextResponse.json({ branches });
  8. } catch (error) {
  9. console.error("[api/branches] Fehler:", error);
  10. return NextResponse.json(
  11. { error: "Fehler beim Lesen der Niederlassungen" },
  12. { status: 500 }
  13. );
  14. }
  15. }