Using Fastify’s plugins
The project structure is almost complete. Fastify’s ecosystem helps us improve our scaffolding code base with a set of plugins you will want to know about. Let’s learn about them and add them to the plugins/
folder.
How to get a project overview
Documenting a complete list of all the application’s endpoints is a tedious task, but someone in the team still has to do it. Luckily, Fastify has a solution for this: the @
fastify/swagger
plugin.
You can integrate it by creating a new plugins/swagger.js
file:
module.exports = fp(async function (fastify, opts) { fastify.register(require('@fastify/swagger'), { routePrefix: '/docs', exposeRoute: fastify.secrets.NODE_ENV !== ‹production›, swagger: { info: { title: 'Fastify app...