Fastify 3.0 released with new type definitions and improved TypeScript support

1_HfyYJvyTjaBaf-cYyvrmuQ-1024x683.jpeg

The release of Fastify 3.0 – a Node.js web framework – includes brand new type definitions, new full support of Express middleware, and the refactored request validation. 

This is the framework’s final release of the third major version.

The latest release includes some noticeable breaking changes  such as middleware support does not come out-of-the-box with the framework itself. 

Also, the logging serializers have been updated to now Fastify ‘Request’ and ‘Reply’ objects instead of native ones. Any custom serializers must be updated if they rely on those properties, according to the development team. 

The non-standard ‘replace-way’ shared schema support has been removed and replaced with JSON Schema specification compliant ‘$ref’ based substitution. 

The ‘setSchemaCompiler’ and ‘setSchemaResolver’ options have been replaced with the setValidatorCompiler to enable future tooling improvements.

Additionally, hooks now have consistent context regardless of how they are registered, and the ‘connectionTimeout’ and keepAliveTimeout’ options have been added. 

With the new version, developers can now use the throw object as error feature and utilize async-await support for plugins. 

Fastify 3.0 is covered by the LTS support cycle, which means at least six months of support provided by the core team, plus an additional six months of security fixes after LTS goes into maintenance when v4 is released.

Version 2 is scheduled to reach end of life in early January 2021. 

Additional details on the new release are available here.

Credit: Source link