import { env } from '$env/dynamic/private'; import type { RequestHandler } from './$types'; // 服务端使用 Docker 内部地址 const API_URL = env.API_URL || 'http://localhost:8080'; export const GET: RequestHandler = async ({ params, fetch }) => { const path = params.path; const response = await fetch(`${API_URL}/download/${path}`); return new Response(response.body, { status: response.status, headers: { 'Content-Type': response.headers.get('Content-Type') || 'text/csv', 'Content-Disposition': response.headers.get('Content-Disposition') || '', }, }); };