CBDW2014 - ColdBox RESTFul Services
- 17. STEP #2: REST
URI routes are built up w/a combo of
resources and actions
Resources = objects
made/managed thru the model
represented by nouns
Actions = functions
built in the handlers
represented by verbs
- 19. Routes
Routes = "how we reach our handlers"
built in the ModuleConfig.cfc
Build them up with:
resource (nouns)
action (verbs)
- 22. - docs
Returning data
"The most common way to return data
from your handler's action is to use
the even object's renderData()
method. It takes complex data and
turns it into a string representation"
- 30. Using Status Codes
1. event.renderData() (shortcut)
statusCode & statusMessage attr
2. event.setHTTPHeader() (manual)
statusCode & statusText attr
- 31. Restricting HTTP verbs
in our routes, we mapped HTTP verbs
to handler actions, but how can we
prevent users from hitting resources
w/the wrong verbs? (aka a GET to a
delete function)