import { Handlers, PageProps } from "$fresh/server.ts"; import { getNote } from "@/db/mod.ts"; import { Page } from "@/components/Page.tsx"; import { type Note } from "@/types.ts"; export const handler: Handlers = { async GET(request, context) { console.debug({ request, context }); const note = await getNote(context.params.id); if (!note) throw "unable to fetch from database"; return await context.render(note); }, }; export default function NotesPage( { data: { id, createdAt, content } }: PageProps, ) { return ( Back to notes

Note {id} created at {createdAt.toLocaleString()}

{content}
); }