I’d like to create a restful service without having to define any specific routes for each “verb”.

I know that I can specify routes for the specific methods, but I think I saw an example somewhere where these were defined in the handlers and not in the routes file… can anyone point me to such an example?


If you generate a handler you will see some code at the top that allows you to put verb restrictions on handler methods. Ie. this.allowedMethod = {delete=‘POST,DELETE’, index=‘GET’}

Nolan Dubeau

Load .,8,1

You can define a single route that understands which action to execute based on the “verb”.

GET = “show”,
DELETE = “remove”,
POST = “create”,
PUT = “update”



If I may ask a dumb question but why are routes defined in the routes.cfm? It seems it would make more sense to define them in the handlers. Just curious…

Jeremy R. DeYoung

Pretty much the decision to have them outside of your handler implementation is to have them decoupled from the handlers. Also, there is one routing table you can look at instead of tons of handler code. And also, you can create mutliple routes that point to the same handler methods instead of binding a handler method to only one route.

That’s pretty much why it is separate and not in the handler itself.

Luis F. Majano
Ortus Solutions, Corp

ColdBox Platform:
Linked In:
IECFUG Manager:


Awesome. Just curious.

Loving 3.1 btw

Jeremy R. DeYoung

Luis must have stolen my email from the outbox :slight_smile: