Skip to content

Getting Started

wooter is runtime-agnostic. You define routes and call fetch.

Terminal window
deno add jsr:@bronti/wooter
Terminal window
npx jsr add @bronti/wooter
import { c, Wooter } from "https://esm.sh/jsr/@bronti/wooter"
import { c, Wooter } from "@bronti/wooter"
const router = new Wooter()
router.route(c.chemin(), "GET", ({ resp }) => {
resp(new Response("hello"))
})
router.route(c.chemin("posts", c.pNumber("id")), "GET", ({ params, resp }) => {
resp.json({ postId: params.get("id") })
})
export default router

You can provide per-method handlers in one route declaration.

router.route(c.chemin("posts"), {
GET: ({ resp }) => resp.json([{ id: 1 }]),
POST: ({ resp }) => resp(new Response(null, { status: 201 })),
})