An example of registering the plugin to Express middleware:

    Remember that middleware can be encapsulated; this means that you can decide where your middleware should run by using register as explained in the plugins guide.

    Restrict middleware execution to certain paths

    If you need to only run middleware under certain paths, just pass the path as the first parameter to use and you are done!

    Fastify offers some alternatives to the most commonly used middleware, such as fastify-helmet in case of , fastify-cors for , and fastify-static for .