register calls name the official plugins by what they add.
library: { name: "fastify", versions: ">=4 <6" }. It only narrates files that import or require Fastify or belong to a package that depends on it (see Dependency detection), so an Express app in the same repository is not mistaken for a Fastify server.
Examples
A route with a schema
English
Hooks, decorators and plugins
English
Versions
reply.redirect swapped its arguments in Fastify 5: it is redirect(url, code) where Fastify 4 had redirect(code, url). When the status code is a literal number the plugin can tell which is which. Otherwise it uses the major version your package declares, or the one you pin with version.
What it covers
- Servers:
Fastify()andrequire("fastify")()with their options,listen,close,readyandinjectin tests. - Routes: the shorthand methods,
route()with several methods, one-line handlers, and returned values as replies. - Schemas: JSON Schema and TypeBox for
body,querystring,paramsandheaders, and reply shapes per status code. - Replies:
send,codeandstatus, headers,redirect, and the request’s parts. - Hooks (
onRequest,preHandler,onCloseand the rest), route-level hooks, decorators, error and not-found handlers. - Plugins:
registerwith prefixes and options, official@fastify/*plugins by name, autoload, inline plugins andfastify-plugin.
Translating
The English phrasebook is exported asen and typed as FastifyPhrases.