You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
The current approach to passing middlewares during router initialization has limitations, particularly when we want to configure middlewares on a per-endpoint basis. Presently, it is either an all-or-nothing scenario, where all middlewares are added to a certain endpoint group or none are added at all. This lack of flexibility makes it challenging to customize middleware behavior for specific endpoints.
Describe the solution you'd like
I propose an improvement to the way middlewares are passed during router initialization. The goal is to provide more granular control over middleware configuration for individual endpoints. Here are some suggested options to achieve this:
Endpoint-Specific Middleware: Allow the ability to specify middleware functions or middleware arrays for each endpoint separately. This way, we can define unique middleware chains tailored to the needs of each endpoint.
Middleware Configuration Object: Introduce a configuration object that maps endpoints to the middleware functions or arrays they require. This object would allow us to easily configure middleware chains for different endpoints in a structured manner.
Middleware Priority: Enable setting priorities or ordering for middleware execution at the endpoint level. This ensures that specific middleware functions are executed before others, providing greater control over request processing.
Default Middleware: Retain the option to specify default middlewares that will be applied to all endpoints, but also allow overriding or extending these defaults at the endpoint level.
Describe alternatives you've considered
The current approach of passing middlewares as an array during router initialization is straightforward but lacks the flexibility needed to configure middleware behavior on a per-endpoint basis. The suggested options aim to address this limitation while maintaining backward compatibility.
Additional context
By improving the way middlewares are passed to the router initialization, we can achieve a more flexible and modular approach to request handling. This will enhance the server's ability to handle different types of endpoints with specific middleware requirements. Any further suggestions or considerations for the proposed changes would be valuable for discussion and implementation.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
The current approach to passing middlewares during router initialization has limitations, particularly when we want to configure middlewares on a per-endpoint basis. Presently, it is either an all-or-nothing scenario, where all middlewares are added to a certain endpoint group or none are added at all. This lack of flexibility makes it challenging to customize middleware behavior for specific endpoints.
Describe the solution you'd like
I propose an improvement to the way middlewares are passed during router initialization. The goal is to provide more granular control over middleware configuration for individual endpoints. Here are some suggested options to achieve this:
Endpoint-Specific Middleware: Allow the ability to specify middleware functions or middleware arrays for each endpoint separately. This way, we can define unique middleware chains tailored to the needs of each endpoint.
Middleware Configuration Object: Introduce a configuration object that maps endpoints to the middleware functions or arrays they require. This object would allow us to easily configure middleware chains for different endpoints in a structured manner.
Middleware Priority: Enable setting priorities or ordering for middleware execution at the endpoint level. This ensures that specific middleware functions are executed before others, providing greater control over request processing.
Default Middleware: Retain the option to specify default middlewares that will be applied to all endpoints, but also allow overriding or extending these defaults at the endpoint level.
Describe alternatives you've considered
The current approach of passing middlewares as an array during router initialization is straightforward but lacks the flexibility needed to configure middleware behavior on a per-endpoint basis. The suggested options aim to address this limitation while maintaining backward compatibility.
Additional context
By improving the way middlewares are passed to the router initialization, we can achieve a more flexible and modular approach to request handling. This will enhance the server's ability to handle different types of endpoints with specific middleware requirements. Any further suggestions or considerations for the proposed changes would be valuable for discussion and implementation.
The text was updated successfully, but these errors were encountered: