Replies: 1 comment 1 reply
-
@nazmulpcc thanks for bringing this up 👍 @clue and I also talked about this topic when we were introducing middleware to Framework X. There is no right or wrong with this, both ways work fine, we originally chose the current implementation because it made more sense to us and it also resembles the order of execution (and it is called middleware so it belongs in the middle ^^). I can see why you would consider this approach to be inconsistent and like I said before I don't have anything against your approach, it is as right as ours is. I don't want to decide on this yet, I rather want to hear what others have to say about this. 🍻 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, a middleware can be added to a route by putting it before the
action
parameter. From the official documentation,While this works, among other things, if you have many routes, you will end up in a situation where you have some routes that have the action parameter at the second, some has it at the third position.
This can get a bit confusing. Instead, I think a better syntax would be,
This way, the action comes at a consistent position and it is super clear that we have added a middleware. This syntaxt will also make future improvements easier to add. For example,
Let me know what you guys think.
Beta Was this translation helpful? Give feedback.
All reactions