export async function GET(req: Request) { try { const url = new URL(req.url); const baseUrl = process.env.LEDGERONE_API_URL ?? "http://localhost:3051"; const res = await fetch(`${baseUrl}/api/transactions${url.search}`); const body = await res.text(); return new Response(body, { status: res.status, headers: { "Content-Type": res.headers.get("content-type") ?? "application/json" } }); } catch { return new Response( JSON.stringify({ data: [], meta: { timestamp: new Date().toISOString(), version: "v1" }, error: { message: "Backend unavailable." } }), { status: 503, headers: { "Content-Type": "application/json" } } ); } }