What is a plugin?
A Fastify plugin is a component that allows developers to extend and add functionalities to their server applications. Some of the most common use cases for developing a plugin are handling a database connection or extending default capabilities – for example, to request parsing or response serialization.
- A plugin can register other plugins inside it.
- A plugin creates, by default, a new scope that inherits from the parent. This behavior also applies to its children and so on, although using the parent’s context is still possible.
- A plugin can receive an
optionsparameter that can be used to control its behavior, construction, and reusability.
- A plugin can define scoped and prefixed routes, making it the perfect router.
At this point, it should be clear that where other frameworks...