19 lines
499 B
TypeScript
19 lines
499 B
TypeScript
|
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} />;
|
||
|
}
|