21 lines
489 B
TypeScript
21 lines
489 B
TypeScript
import { NextResponse } from "next/server";
|
||
|
||
/**
|
||
* 代理中国地图 GeoJSON,避免前端 CORS
|
||
*/
|
||
export async function GET() {
|
||
try {
|
||
const res = await fetch(
|
||
"https://geo.datav.aliyun.com/areas_v3/bound/100000_full.json"
|
||
);
|
||
const data = await res.json();
|
||
return NextResponse.json(data);
|
||
} catch (e) {
|
||
console.error("Failed to fetch china map:", e);
|
||
return NextResponse.json(
|
||
{ error: "Failed to load map" },
|
||
{ status: 500 }
|
||
);
|
||
}
|
||
}
|