4 ms·
> Nextjs 13.1 just added actual server-side middleware the middleware has been available for awhile, they just added a few "advanced" features it looks like.
by deckard1 4y ago
> Nextjs 13.1 just added actual server-side middleware
the middleware has been available for awhile, they just added a few "advanced" features it looks like.
The problem with their middleware is that it's based on their edge runtime. Which is pretty much very basic web APIs and nothing more. Unlike Express/Koa, you do not have the full node API and cannot do things like read files from the filesystem. It's a total unnecessary clusterfuck just so Vercel can get you on their cloud services. Every single day I work with Next.js I wish I had Express and a decent router.
- super256 4y agoI like fastify more than express due to the great opinions (json schema, hooks etc). I use fastify + the fastify-nextjs plugin. It works great and lets you expose custom request decorations from node.js to next.js. Maybe this can help you too: https://github.com/fastify/fastify-nextjs https://github.com/fastify/fastify-nextjs The only drawback is the slow startup time of next.js, which becomes really annoying with huge next.js projects. But for smaller projects, fastify-nextjs is fine.