2026-05-14 00:04:26 +08:00
|
|
|
import { NextRequest, NextResponse } from "next/server";
|
|
|
|
|
import { buildBackendRequestHeaders } from "@/lib/backend-auth";
|
|
|
|
|
|
|
|
|
|
const API_BASE = process.env.POLYWEATHER_API_BASE_URL;
|
|
|
|
|
|
|
|
|
|
export async function GET(req: NextRequest) {
|
|
|
|
|
if (!API_BASE) {
|
2026-05-14 00:23:03 +08:00
|
|
|
return NextResponse.json({ error: "API not configured" }, { status: 500 });
|
2026-05-14 00:04:26 +08:00
|
|
|
}
|
|
|
|
|
const auth = await buildBackendRequestHeaders(req, { includeSupabaseIdentity: false });
|
2026-05-14 00:23:03 +08:00
|
|
|
const res = await fetch(`${API_BASE}/m/json`, { headers: auth.headers });
|
|
|
|
|
return NextResponse.json(await res.json());
|
2026-05-14 00:04:26 +08:00
|
|
|
}
|