January 2014
Intermediate to advanced
232 pages
5h 11m
English
Compojure is a routing library built on top of Ring. It provides an easy way to associate handler functions with a URL and an HTTP method. A Compojure route might look like this:
| | (GET "/:id" [id] (str "<p>the id is: " id "</p>" )) |
The route name maps to an HTTP method name, such as GET, POST, PUT, DELETE, or HEAD. There’s also a route called ANY that matches any method the client supplies. The URI can contain keys denoted by using a colon, and their values can be used as parameters to the route. This feature was inspired by a similar mechanism used in Rails and Sinatra.[27][28] The route’s response will be automatically wrapped in the Ring response described earlier.
Since we’re likely to have ...
Read now
Unlock full access