import { Handlers, PageProps } from "$fresh/server.ts"; import { listNotes } from "@/db/mod.ts"; import { type Note } from "@/types.ts"; import { NoteItem } from "@/components/Note.tsx"; 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(NoteItem)} ); }