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 result = await getNote(context.params.id); if (!result) throw "unable to fetch from database"; const [note] = result.rows as Note[]; 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}
); }