Skip to content

v0.53.0 — route config

Choose a tag to compare

@tshafer tshafer released this 11 Jul 16:51
· 105 commits to main since this release

The genuine gap from Fastify’s Routes page: per-route config / metadata.

  • .config({ scope: "admin", rateTier: "high" }) on a route or group attaches arbitrary metadata, read in the handler or route middleware via request.route.config — for per-route flags (auth scope, rate tier, layout choice).
  • Group config merges into every route, with a route’s own keys winning.
  • The matched-route context is now set before a route’s middleware, so route/group middleware can branch on request.route.

On the other two references checked:

  • Request — already comprehensive (method/path/url/headers/param/query/body/all/input/only/except/cookie/file(s)/accepts/ip(s)/subdomain/raw/route…). request.route now also carries config.
  • Server — already covered by the Application lifecycle (boot/onReady/onShutdown/terminate), HttpKernel, the keel routes command (printRoutes), and testClient (inject).

345 tests; type-checked doc examples (which caught the RouteDefinition literal needing the new field). See docs/routing.md.