'x'
This commit is contained in:
20
app/api/geo/china/route.ts
Normal file
20
app/api/geo/china/route.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
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 }
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user