elysiajs / elysia

Ergonomic Framework for Humans
https://elysiajs.com
MIT License
9.23k stars 198 forks source link

Lacking route-specific middleware chain #591

Open hjb1694 opened 3 months ago

hjb1694 commented 3 months ago

What is the problem this feature would solve?

I would like to see a solution where I can pass multiple handlers or middlewares to a specific route, being able to funnel the request through and prevent passage to subsequent handlers.

What is the feature you are proposing to solve the problem?

I would like to be able to pass multiple handlers in an array, similar to Express. Maybe produce a function to create a new middleware chain, where the argument passed is an array of handlers, or provide the option to pass an array of handlers/middleware where a single handler is the only option at this time.

What alternatives have you considered?

I have seen examples of custom middleware implementations that are framework agnostic, but I do question their robustness.

phrynus commented 3 months ago

Yes, manual middleware can make code inefficient and difficult to understand