fix: add city rooms proxy route

This commit is contained in:
Apple
2025-11-28 03:37:05 -08:00
parent e853b29126
commit cd48b32bb7

View File

@@ -0,0 +1,30 @@
import { NextRequest, NextResponse } from "next/server";
const API_BASE = process.env.CITY_API_BASE_URL || process.env.INTERNAL_API_URL;
export async function GET(_req: NextRequest) {
if (!API_BASE) {
return NextResponse.json(
{ error: "CITY_API_BASE_URL is not configured" },
{ status: 500 }
);
}
try {
const res = await fetch(`${API_BASE}/city/rooms`, {
method: "GET",
headers: { "Content-Type": "application/json" },
cache: "no-store",
});
const data = await res.json().catch(() => null);
return NextResponse.json(data, { status: res.status });
} catch (error) {
console.error("City rooms proxy error:", error);
return NextResponse.json(
{ error: "Failed to fetch city rooms" },
{ status: 502 }
);
}
}