-
-
Notifications
You must be signed in to change notification settings - Fork 652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(middleware/combine): Introduce combine middleware #2941
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2941 +/- ##
==========================================
+ Coverage 94.42% 95.91% +1.49%
==========================================
Files 136 138 +2
Lines 13343 13662 +319
Branches 2219 2299 +80
==========================================
+ Hits 12599 13104 +505
+ Misses 744 558 -186 ☔ View full report in Codecov by Sentry. |
Hey @usualoma . This middleware is unique and exciting, and implementations like |
Hi @usualoma Sorry for the super late reply. My concern is only the naming! Honestly, I don't like a Hmm. I prefer to |
@yusukebe Thank you! I see. import { some, every } from 'hono/composite-middleware' But I agree with you on Do you want to |
I think I understand the duplication with an already existing function ( import { some, every } from 'hono/compose' |
My idea import { some, every } from 'hono/grouping' but, duplication with |
Hey @usualoma @EdamAme-x ! I'm considering it. Your suggestions are good, but:
And Then. What about import { Hono } from 'hono'
import { every, some } from 'hono/combine' |
hi @yusukebe
|
I prefer
For example, I think it's weird that |
|
OK, let's proceed with |
@usualoma Thanks! |
Updated af3e7c5 Dependency on TrieRouterThere is no functional problem, but I am a little concerned about whether it is acceptable to have a dependency on TrieRouter. It would be best if I could use the router I use for that app. But there's no way to get that, so it's not an option at the moment, though. |
I have considered it for a while and concluded that using TrieRouter is good, as is yours. As you said, it would be best if it could use the current app's router, but using TrieRouter is fine. Many users use the default SmartRouter, which includes TrieRouter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Hi @usualoma I've reviewed it. There is no problem, and it looks good! Thank you for your awesome work. I'll merge this into the |
@yusukebe Thank you! |
Proposes middleware to compose multiple middleware. This middleware provides the following three functions.
Usage is as indicated in comments and tests.
This change will allow users to write code similar to that illustrated in the comments below.
#2813 (comment)
Name of middleware
I named it "predicate", but I am not particularly particular about it, so it could be named something else. I also thought of "compose", but it is now "predicate" because it is confusing because it is covered by "compose", which we use internally.
The author should do the following, if applicable
bun run format:fix && bun run lint:fix
to format the code