flow-development-collection icon indicating copy to clipboard operation
flow-development-collection copied to clipboard

Support defining routes on the actions via annotation

Open albe opened this issue 5 years ago • 0 comments

See slack thread: https://neos-project.slack.com/archives/C050KKBEB/p1593764548080600

Some excerpt quotes:

@mficzel: I noticed that quite often people struggle with the configuration of routes and policies that are required to actually use a flow controller. Made even worse by the need to write a setting for the route to be actually included. Symfony offers configuration via annotation for that and i think @Flow\Route() or @Flow\Policy˜ could be really helpful and easy to get when placed directly at the controller action. Offcourse you loose some flexibility. Is there a reason why we do’nt offer this as an additional option?

@bwaidelich: Originally I thought that it would be a good idea to separate routes completely from the controllers so that you can for example change the URLs of a 3rd party package. And I still think that this is a valid point.. But for the 90+% applications this is probably not a requirement at all and comes with needless complexity.. So I’d be all in for a Route Annotation (maybe even a way to specify the URL directly, so that no Routes.yaml file is required!? As for Permissions I personally think that it is not a good idea to target controller actions at all since they should just delegate I/O.. But what I would like to see was an easy way to make a Domain Service restricted by default and then whitelist public methods via annotation to certain roles

@albe: dotnet framework has a similar approach to defining routes and it works relatively well. Basically: @HttpPost("route/to/action/{with}/{parameters}")

@mficzel: Configuration should override annotation and for generic packages Routes.yaml should still be used.

@radmiraal if you hit conflicts having the same route routing to different controllers based on loading order has a certain smell :slightly_smiling_face:

@albe: I'd rather go the other route: annotation > configuration If you clearly specify the route an action is supposed to be reachable at, that should not be overridden through some configuration somewhere

albe avatar Jul 21 '20 09:07 albe