+server.js 535 Bytes
import { API_HOST } from '$lib/api.js';
const API_BASE = API_HOST + '/api/finfun/clasificador';

export async function GET() {
  try {
    const response = await fetch(API_BASE);
    if (!response.ok) throw new Error();
    const data = await response.json();
    return new Response(JSON.stringify(data), {
      headers: { 'Content-Type': 'application/json' }
    });
  } catch {
    return new Response(JSON.stringify({ error: 'Failed to fetch' }), {
      status: 500, headers: { 'Content-Type': 'application/json' }
    });
  }
}