addRoute() enhancement

Description

I think Brad described this best:
addRoute(pattern="api/:handler/:action",viewNoLayout="true",package="site/APIHandlers");

And then the URL:
mysite.com/api/user/edit

would map to the following handler?
/handlers/site/APIHandlers/user

This would effectively allow us to do things like:
addRoute(pattern="api/:handler/:action",viewNoLayout="true",package="site/api/v1/"); Note the '/v1/' in the path/package.

More specifically, there should be no confusion between "/handler/roles.cfc" and "/handlers/site/api/v1/roles.cfc" because I told the route where to go path/package wise.

Activity

Show:
Luis Majano
June 3, 2015, 2:33 PM

implemented via with routing closures

Brad Wood
June 3, 2015, 2:34 PM

Can you confirm that ? You suggested closures in the original forum thread but the OP said that didn't solve the problem. Perhaps you can include sample code that does what this ticket is asking for using that feature.

Luis Majano
June 3, 2015, 2:49 PM

Ok, I get it know. It is just prepending the virtual :handler portion.

I don't know about a use case for this that is so impactful. Anyways, I will re open so we can evaulate it as we will redeisng our routing API

Brad Wood
June 3, 2015, 3:14 PM

A possible use case would be a large number of handlers in a "deep" package, but you want to shorten the SES route for all of them without manually creating a route for each handler. Or perhaps to repoint an entire API from /v1/ to /v2/ behind the scenes with a single line.

Luis Majano
March 1, 2018, 6:29 PM

This is going to be resolved using the new routing DSL and group closures.

Assignee

Luis Majano

Reporter

Todd Rafferty

Labels

None

Components

Priority

Major
Configure