freshter-logs/routes/index.tsx

19 lines
499 B
TypeScript
Raw Normal View History

2023-04-28 19:48:34 -04:00
import { Handlers, PageProps } from "$fresh/server.ts";
import { get_db_obj } from "db";
import { Database } from "types";
import Home from "../islands/Home.tsx";
export const handler: Handlers<Database> = {
async GET(req, ctx) {
const db = await get_db_obj();
if (db.isNone()) {
return ctx.renderNotFound();
}
return ctx.render(db.unwrap());
},
};
export default function Index({ data }: PageProps<Database>) {
return <Home db={data} />;
}