Files
2026FIFAWorldCup/platform/web/app/api/analytics/matches/route.ts
QuantBot aa7e3bba76
Some checks failed
2026 World Cup Quant Platform - Production Deployment / Code Quality & Testing (push) Failing after 1m49s
2026 World Cup Quant Platform - Production Deployment / Deploy to Production VM via Rsync (push) Has been skipped
chore: migrate deployment to Gitea Actions with zero-trust rsync
2026-06-16 19:06:50 +08:00

29 lines
857 B
TypeScript

import { NextResponse } from 'next/server';
const ANALYTICS_BACKEND = process.env.ANALYTICS_BACKEND_URL || 'http://127.0.0.1:8000';
export const dynamic = 'force-dynamic';
export async function GET() {
try {
const response = await fetch(`${ANALYTICS_BACKEND}/analytics/matches`, {
method: 'GET',
cache: 'no-store',
headers: {
'Content-Type': 'application/json',
},
});
if (!response.ok) {
const message = await response.text();
return NextResponse.json({ message }, { status: response.status });
}
const data = (await response.json()) as Record<string, unknown>;
return NextResponse.json(data);
} catch (error) {
const message = error instanceof Error ? error.message : '賽事列表服務暫時無法連線';
return NextResponse.json({ message }, { status: 502 });
}
}