Skip to content

v0.9.0 — static routes + response accessor

Choose a tag to compare

@tshafer tshafer released this 10 Jul 19:21
· 160 commits to main since this release

Static-response routes — pass a ready-made response, no closure:

router.get("/health", json({ status: "ok" }));   // static
router.get("/users/:id", () => json({ id: param("id") })); // dynamic needs () =>

The router clones the response per request. Dynamic responses that read the request keep the () => (param() must run per request).

response accessor mirrors request: response.json() · response.text() · response.html() · response.redirect() · chainable response.status(201) / response.header(k, v).

json/text/html/redirect now also work outside a request (plain Response). Docs + changelog updated.