switches to nominatim
This commit is contained in:
17
web/src/routes/api/v1/search/nominatim/+server.ts
Normal file
17
web/src/routes/api/v1/search/nominatim/+server.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
import { env } from "$env/dynamic/private";
|
||||
import { error, json, type RequestEvent } from "@sveltejs/kit";
|
||||
|
||||
export async function POST(event: RequestEvent) {
|
||||
const data = await event.request.json()
|
||||
|
||||
try {
|
||||
const r = await event.fetch(`${env.NOMINATIM_URL}/search?q=${data.q}&format=geocodejson&limit=${data.limit}`)
|
||||
return json(r);
|
||||
} catch (e: any) {
|
||||
console.log(e);
|
||||
|
||||
throw error(e.httpStatus, e)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user