-
Notifications
You must be signed in to change notification settings - Fork 118
Home
Taffy is a free, open-source framework for creating dead-simple REST APIs using ColdFusion CFCs; with a focus on semantically correct URIs, convention over configuration, and harnessing the expressiveness of code metadata.
Implementing an API using Taffy requires only a couple of CFCs and can be done in just a few lines of code. See the Getting Started page for a quick example.
There is also documentation that provides a full reference of everything that you can do with Taffy, and everything that Taffy does for you.
Isn't Taffy just a front-controller ("MVC") framework? Why shouldn't I just use Fusebox / Mach-ii / Model-Glue / etc and some URL rewriting?
Yes, Taffy is just another front-controller framework for ColdFusion. And yes, it uses a similar url-formatting schema to most other frameworks — a spin on what most of them call "Search Engine Safe" ("SES") URLs. However, Taffy does have some key differences.
First of all, it's designed specifically for building REST web services, and nothing else. There is a subset of core HTTP functionality that is specific to REST that most MVC frameworks don't expose, but Taffy does. There is also no need for a controller because of the simplified process that Taffy takes: a URI + an HTTP Verb maps to a specific function, which gets invoked, and its return value is serialized into the requested format before being returned to the client.
Secondly, this isn't your mom's SES URL formatting. Most MVC frameworks take the simple way out and encode ?name=foo
as /name/foo
. Instead, with Taffy, you define that /person/{name}
represents a specific person, and when the consumer requests /person/john-smith
, your person lookup method is passed the argument collection: { name: "john-smith" }
. Specifically: The string "name" is not visible anywhere in the URL.
You could do something similar with another framework and URL rewriting, but defining and maintaining those rewriting rules would be annoying. I wouldn't do it, but you're free to try.
I think that if you give Taffy a try, you'll enjoy its simplicity.