Allow routes to be declared in handlers


Allow developers using SES to declare routes in their event handlers. Allow for a handler-level route, or for action-level routes. Take into consideration all the parameters to addRoute that make sense in this context such as HTTP verbs to match, constraints, pattern, ssl, etcfor handlers but also for actions themselves like this

Example handler Implementation:

The following URLs would all work:

Default SES behavior

With in-handler routes: --> services.companyProducts.index --> services.companyProducts.index --> services.companyProducts.listProducts


Joel Tobey
December 30, 2017, 3:38 PM

I was thinking of creating a module to do just this. If it's going to be in the core, I'm happy to work on this.

Proposal: Should the default behavior also work if you add in-handler routes? I don't think so. I think when you define a route in the handler annotation, it should override the default behavior. It would clear up confusion about which URL to use. If there are concerns of backward compatibility or other forwarding issues, perhaps we provide a 'redirectConventialRoute' annotation (or some other clever name) that defaults to 'true' and does a 301 Moved Permanently redirect. If the flag is set to false, then both URLs would work.

Luis Majano
April 13, 2018, 10:09 PM

I think we can start it as an incubation module and if it merits, then bake it into the core.


Luis Majano


Brad Wood



Epic Link