import { DateTime } from "ts-luxon"; import { request } from "../request"; import { html, render } from "../request/util"; import type { Call, Result, Route } from "../types"; import { loginRoute } from "./login"; import { logoutRoute } from "./logout"; const routes: Record = { hello: { path: "/hello", methods: ["GET"], handler: async (_call: Call): Promise => { const now = DateTime.now(); const c = await render("basic/hello", { now }); return html(c); }, }, home: { path: "/", methods: ["GET"], handler: async (_call: Call): Promise => { const _auth = request.auth; const me = request.session.getUser(); const email = me.toString(); const c = await render("basic/home", { email }); return html(c); }, }, login: loginRoute, logout: logoutRoute, }; export { routes };