Add very basic support for finding and rendering templates
This commit is contained in:
18
express/basic/routes.ts
Normal file
18
express/basic/routes.ts
Normal 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 };
|
||||
Reference in New Issue
Block a user