import fs from "node:fs/promises"; import { isMigratedHtmlPage, relativeWebsitePath, routeFromRelativePath, sourcePathFromRoute, walkHtmlFiles } from "../lib/static-pages"; export function getStaticPaths() { return walkHtmlFiles() .map(relativeWebsitePath) .filter((relativePath) => !isMigratedHtmlPage(relativePath)) .map((relativePath) => ({ params: { route: routeFromRelativePath(relativePath), }, })); } export async function GET({ params }: { params: { route?: string } }) { const html = await fs.readFile(sourcePathFromRoute(params.route), "utf8"); return new Response(html, { headers: { "content-type": "text/html; charset=utf-8", }, }); }