17 lines
849 B
TypeScript
17 lines
849 B
TypeScript
import { readFile } from 'node:fs/promises';
|
|||
|
|
import path from 'node:path';
|
||
|
|
|
||
|
|
export const dynamic = 'force-dynamic';
|
||
|
|
export const runtime = 'nodejs';
|
||
|
|
|
||
|
|
export async function GET() {
|
||
|
|
try {
|
||
|
|
const frontend = JSON.parse(await readFile(path.join(process.cwd(), 'build-info.json'), 'utf8'));
|
||
|
|
const base = process.env.FASTAPI_URL || 'http://localhost:8000/api';
|
||
|
|
const res = await fetch(`${base}/release`, { cache: 'no-store', signal: AbortSignal.timeout(5000) });
|
||
|
|
if (!res.ok) throw new Error('Backend identity unavailable');
|
||
|
|
return Response.json({ frontend, backend: await res.json() }, { headers: { 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' } });
|
||
|
|
} catch {
|
||
|
|
return Response.json({ detail: 'Release identity unavailable' }, { status: 503, headers: { 'Cache-Control': 'no-store', 'X-Robots-Tag': 'noindex' } });
|
||
|
|
}
|
||
|
|
}
|