Good
- clear (api, guide) ๐
- example ๐
Bad
- priority ๐
fastify support application/json
and text/plain
but we can add it by addContentTypeParser
refs
is a fundamental feature of fastify -> encapsulation context
, it control decorators
, hooks
, plugin
, route
refs
decorators API allows customization of the core Fastify objects e.g. server instance
, any request
, reply objects
this might be useful for what we do in express
such as Reflect req
-
extends and reuse custom functionalities
-
plugin can be whatever e.g.
routes
,decorators
- fastify(3.x) not support middleware by default
- not recommended to use this
- like morgan but better with
pino
- fastify tries to catch as many uncaught errors as it can without hindering performance
app.get("/", () => {
throw new Error("error");
}); // -> catch and if `throw new Error` default is status 500, internal error
also can write a custom hook for catch error
- fast allow user to eject each hook starting incoming request e.g.
onRequest
- Fastify uses a schema-based approach