Fundamental_Analysis/frontend/src/app/api/financials/[...slug]/route.ts
2025-10-28 23:31:28 +08:00

13 lines
626 B
TypeScript

import { NextRequest } from 'next/server';
const BACKEND_BASE = process.env.NEXT_PUBLIC_BACKEND_URL || 'http://127.0.0.1:8000/api';
export async function GET(req: NextRequest, { params }: { params: { slug: string[] } }) {
const url = new URL(req.url);
const path = params.slug.join('/');
const target = `${BACKEND_BASE}/financials/${path}${url.search}`;
const resp = await fetch(target, { headers: { 'Content-Type': 'application/json' } });
const text = await resp.text();
return new Response(text, { status: resp.status, headers: { 'Content-Type': resp.headers.get('Content-Type') || 'application/json' } });
}