familyfedie-website/src/pages/[...route].ts
Loyyd 9d0a823351
Some checks are pending
/ deploy (push) Waiting to run
checks
2026-06-11 09:54:39 +02:00

23 lines
708 B
TypeScript

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",
},
});
}