Relax: Generated Routes GET, POST, PUT, DELETE

Hello Guys,

I’m using Relax to defined some web services, and I’ve added the resource which looks like this:

pattern = “/services”,
handler = “services”,
action = “{‘post’:‘save’, ‘put’:‘save’, ‘delete’:‘delete’}”,
Description = “I represent an account services.”,
methods = “POST,PUT,DELETE”,
parameters = [
{name=“service_group_id”,description=“I’m the ID of the service group to add the seivce too.”,required=“false”},
{name=“service_id”,description=“I’m the ID of the service to save/delete”,required=“false”},
{name=“name”,description=“The name of the service.”,required=“false”}

Which I intend to route different request types (PUT, DELETE) to different methods within the ‘services’ handlers.

Now, relax gives me a generated route which looks like this:

addRoute(pattern="/services", handler=“services”, action="{‘get’:‘list’, post’:‘save’, ‘put’:‘save’, ‘delete’:‘delete’}");

Which I have dropped into my routes.cfm file. However, when making requests to this, I get an exception thrown back at me.

Application Execution ExceptionError Type: Expression : [N/A]

Error Messages: Element services.{‘get’ is undefined in a CFML structure referenced as part of an expression.

Can anyone suggest what might be going wrong here?

I’ve been looking through the docs at the SES stuff trying to see if that route definition is right, but I can’t find the information I’m looking for.



I think the : should be =


Hi Ben,

Thanks for the suggestion, however, when changing : to = I then get 404 page not found.



Hi Ben,

Two things: I think it’s because the action is surrounded by quotes, and as Robert mentioned it should use an equal sign. Here is one of my manual route definitions:

GET = “getLocation”,
PUT = “updateLocation”,
DELETE = “removeLocation”

This could be a bug in route generation within Relax.



You are spot on! thank you!

By removing the quotes, both around the structure {} and from around the key names it now appears to be working perfectly.

Thanks so much!


Good stuff Robert!

I assume this might be a bug. I’ll file it as an issue in GitHub.