+server.js
506 Bytes
import { API_HOST } from '$lib/api.js';
const API_BASE = API_HOST + '/api/ubigeo/clasificador';
export async function GET() {
try {
const response = await fetch(API_BASE);
const data = await response.json();
return new Response(JSON.stringify(data), {
headers: { 'Content-Type': 'application/json' }
});
} catch (err) {
return new Response(JSON.stringify({ error: 'Failed to fetch' }), {
status: 500,
headers: { 'Content-Type': 'application/json' }
});
}
}