`middie` vs `fastify-express`
benmccann opened this issue · 3 comments
It's very confusing that there are two separate implementations with very little guidance as to which to use. Why would someone choose one vs the other?
The only thing I can see is that the docs say middie
is faster. Does that mean you should always choose middie
over fastify-express
?
fastify-express
says on its readme that it's not meant to be used as a long-term solution. Is the same also true of middie
?
Is the long-term plan to continue supporting two separate implementations of the same thing or will one eventually be deprecated in favor of the other?
middie
is a middleware plugin. fastify-express
bundles express
.
Is the long-term plan to continue supporting two separate implementations of the same thing
They are not the same thing.
Thanks for clarifying. https://fastify.dev/docs/v3.29.x/Reference/Middleware/ refers to them as the same
Yes, both plugins are able to support "middleware" style modules, and that document is about middleware. So it does not go into the other differences of the plugins. It does, however, link out the the plugins's projects. Referring to those links, we can see:
https://github.com/fastify/fastify-express
This plugin adds full Express compatibility to Fastify, it exposes the same use function of Express, and it allows you to use any Express middleware or application.
https://github.com/fastify/middie
@fastify/middie is the plugin that adds middleware support on steroids to Fastify.
The syntax style is the same as express/connect. Does not support the full syntax middleware(err, req, res, next), because error handling is done inside Fastify.
Note that one plugin does more than middleware.