-
Notifications
You must be signed in to change notification settings - Fork 13
Add support for Route attribute on handler classes #278
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
base: master
Are you sure you want to change the base?
Conversation
|
@markphillips100 technically speaking ddf2378 is a breaking change which should be released as 2.0.0, I see no issues in postponing this to the next major release; with the current design of handlers is gives no benefits at all. |
|
Scratch #278 (comment) Mark, the forward "/" has to be trimmed from the template. I do really need to dive a bit in the way they do it, I'm spending too much time guessing. |
|
That's fine @mauroservienti . No rush. I'll add my 2 cents but I could be missing something of course. In terms of the "/" usage pattern, as far as I am aware the existence of an "/" or "~/" at the start of an action's route (or route verb) only serve to inform the router whether to prepend the class (controller) route path to the action route. Once that decision is made the actual resulting path is a concatenation of the class and action path just without any "~" or "//". I'd assume you could do the same and strip the leading "/" off this final path if one exists. The MVC examples show the use of [Route(...)] on actions whereas we've only used http verb attributes. Our usage of http verb attributes implied a 1-to-1 mapping of routes to method. MVC's implies there can be many routes that get directed to the single method. If we assume that a composition handler should only include methods for the exact same route then I'd assume that changes how endpoints and the composition handler are created and registered with routing. For example, each "discovered" method could result in numerous route paths. Each of these paths needs its own endpoint registration and list of other composition types/methods that also support the specific route path used for the registration, i.e. those other handlers (or subscribers) could also support multiple routes. It's not a trivial problem for sure. So I guess another question is, should the package support [Route] on methods in a similar way, or should it be limited to verbs on methods and Route attribute on class only? |

Fix #148
PoA