route.ts 613 B

123456789101112
  1. import { NextRequest, NextResponse } from 'next/server';
  2. import { ResultDto } from '@/types/response/common';
  3. import { fetchJson } from '@/lib/utils/server';
  4. // 시장 데이터 프록시 — 전부 익명 GET (지수/ETP/채권/파생/상품/ESG/환율/금리/공시)
  5. export async function GET(request: NextRequest, { params }: { params: Promise<{ path: string[] }> }) {
  6. const { path } = await params;
  7. const endpoint = `/api/market/${path.join('/')}`;
  8. const url = new URL(request.url);
  9. const res: ResultDto = await fetchJson(`${endpoint}${url.search}`, { method: 'GET' });
  10. return NextResponse.json(res);
  11. }