import { Handlers, PageProps } from "$fresh/server.ts"; import { listNotes } from "@/db/mod.ts"; import { Page } from "@/components/Page.tsx"; import { type Note } from "@/types.ts"; export const handler: Handlers = { async GET(_request, context) { return await context.render(await listNotes() || []); }, }; export default function NotesPage({ data: notes }: PageProps) { return (

List of Notes

Create a note:

{notes.map(({ id, content, createdAt }) => (
Note {id}{" "} created at {createdAt.toLocaleString()}
{content}
))}
); }