Add very basic support for finding and rendering templates

This commit is contained in:
2026-01-10 13:50:44 -06:00
parent 9e3329fa58
commit 6e96c33457
4 changed files with 67 additions and 0 deletions

18
express/basic/routes.ts Normal file
View File

@@ -0,0 +1,18 @@
import { DateTime } from "ts-luxon";
import type { Call, Result, Route } from "../types";
import { html, render } from "../util";
const routes: Record<string, Route> = {
hello: {
path: "/hello",
methods: ["GET"],
handler: async (call: Call): Promise<Result> => {
const now = DateTime.now();
const c = await render("basic/hello", { now });
return html(c);
},
},
};
export { routes };