Library for painless and powerful API route middleware #19721
Unanswered
htunnicliff
asked this question in
Show and tell
Replies: 1 comment
-
It elegantly solved my problem. You made my day. Thanks! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey Next.js community 👋!
Using middleware in Next.js API routes has always vexed me — why couldn't the simple middleware patterns from Express (or even better, Koa) be brought into Next applications?
After writing far too many workarounds in my own applications to get middleware working well, I decided to put some effort into making a library (
next-api-middleware
) to solve the problem!Here's how it works:
The library exposes two primary methods –
use
andlabel
– for easily composing groups of middleware. Please give this library and try and let me know what you think!Beta Was this translation helpful? Give feedback.
All reactions