- Supabase auth 왕복 1-2s 제거 (집계 데이터는 인증 불필요) - Cache-Control: s-maxage=600 으로 Vercel Edge CDN 캐싱 적용 - 동일 요청 10분간 NAS 호출 없이 CDN에서 즉시 응답 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
538 B
TypeScript
16 lines
538 B
TypeScript
import { NextResponse } from 'next/server';
|
|
import { nasGet, handleNasError } from '../../_nas';
|
|
|
|
// 공개 집계 데이터 — 인증 불필요, Vercel CDN에서 10분 캐시
|
|
export const maxDuration = 60;
|
|
export const revalidate = 600; // 10분
|
|
|
|
export async function GET() {
|
|
try {
|
|
const data = await nasGet('/api/lotto/stats/performance');
|
|
const res = NextResponse.json(data);
|
|
res.headers.set('Cache-Control', 's-maxage=600, stale-while-revalidate=60');
|
|
return res;
|
|
} catch (err) { return handleNasError(err); }
|
|
}
|