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
add user middleware chain function #1913
Conversation
I think it over and over, and don't think let users pass a chain is not easy to understand. Need more easy-to-understand solution for this. |
On the basis of not affecting the functions of the existing framework, it may be a good option to allow users to customize some functions in the middleware processing.
|
If the implementation is not elegant enough, please provide some suggestions, thanks |
I'm thinking of the following method: svr.WithMiddlewares(middlewares ...Middleware) And default middlewares are disabled. |
I don't think this way can customize middleware order |
The calling order of the middleware before entering the route is relatively fixed. I think it is also a good choice to determine the execution order of the middleware through the order of the variable parameters passed in. |
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
According to different business scenarios, the choice of middleware chain should be user-selectable, and considering performance issues, invalid middleware should be eliminated