11. Why REST?
When compared to SOAP
(Simple Object Access Protocol),
REST is considered:
lighter weight
easier to use (for the most part)
more flexible
12. REST basics
App architecture style
HTTP request-response model
hence web focused
REpresentational State Transfer
Supports HTTP methods:
GET, POST, PUT, DELETE, OPTIONS
Returns data in different formats
JSON, text, XML, etc.
13. How We Rest
5 key options
2 servers
3 frameworks
14. Natively available in CF10+
Uses separate servlet to run REST
Register your RESTful services
register/manage RESTful aspects in
CFC via metadata
17. CFC code
SHOW TIME!!!
(examples/CF10quarterback.cfc
in github repo)
18. Considerations
"/rest" mapping
can change this by revising the context path for the REST
servlet in web.xml
Metadata in CFCs
Advocates: truly REST
Critics: verbose, confusing
19. Natively available in Railo 4+
Uses separate servlet to run REST
Register your RESTful services
register/manage RESTful aspects in
CFC via metadata
24. REST focused framework
Design: make REST simple for CF
works as far back as CF8
mostly conventions, some
configurations necessary
25. Setup/Configuration
Download from
Taffy.io
Github (github.com/atuttle/Taffy)
Unzip into web root (preferred) or API
subfolder
Application CFC attribute:
extends="taffy.core.api"
30. Setup/Configuration
Preferred workflow:
made directory for your app
install ColdBox & preferred app skeleton
install RELAX module
Takes roughly a minute
Best Practice: setup all your REST
CFCs in an API module
32. CFC code
SHOW TIME!!!
(examples/ColdBoxTeam.cfc
in github repo)
33. Unique Considerations
Simple implementation
Very extensible within Box family
RELAX as tester & documentation
well documented
Routes fully customizeable
Very little unique code in CFC
35. Setup/Configuration
Download from
fw1.riaforge.org
github.com/framework-one/fw1
coldbox.org/forgebox/view/fw1
setup app in application.cfc
set routes/return data
39. Recommendations
Every option works
non-frameworks vs frameworks
application architecture style &
extensibility
what you wanna do "under the hood"
There is no universal "right option"
40. REST is not afancy or a gimic
Take security seriously
Make your API robust
get Creative!!!