Files
zk-data-agent/frontend/app/app/annotations/[name]/route.ts
T
2026-07-20 10:56:59 +08:00

29 lines
767 B
TypeScript

import { readFile } from "node:fs/promises";
import { resolveAnnotationPage } from "@/lib/annotation-pages";
export const runtime = "nodejs";
export const dynamic = "force-dynamic";
export async function GET(
_request: Request,
{ params }: { params: Promise<{ name: string }> },
) {
const { name } = await params;
const filePath = resolveAnnotationPage(name);
if (!filePath)
return new Response("Invalid annotation page", { status: 400 });
try {
const content = await readFile(filePath);
return new Response(content, {
headers: {
"cache-control": "no-store",
"content-type": "text/html; charset=utf-8",
"x-content-type-options": "nosniff",
},
});
} catch {
return new Response("Annotation page not found", { status: 404 });
}
}