Rook is considerably more opinionated than Liberator and is based on extending the Ring metaphor: building up the functionality of the web application by introducing layers of middleware.
The explicit goal is a mapping of URIs to endpoint functions within a namespace, and the introduction of customized-per-endpoint middleware to facilitate it. It also adapts idea from the Inversion-of-Control world in terms of what argument values are passed to the endpoint function. Liberator is a bit more compliant and flexible in certain areas, but that comes at some cost. For some applications, Liberator's approach is likely better, but for most cases (such as building a REST API to support a rich client web application), I feel that most people will be more productive in Rook. For example, Rook somewhat "normalizes" the submission; you can define a schema for the incoming request, and Rook can validate that the submitted request body matches the request (and even leverage some of Prismatic Schema's coercions) BUT it would be difficult to have one schema for application/json and a different schema for application/edn. In practice, we use schemas like {:user_id s/UUID, s/Any s/Any} if we want to make life simpler for JSON clients. For the kinds of application I've been writing, I feel I am writing less code in Rook that I would in Liberator ... but I have not used Liberator, just attended a conj session on it, and skimmed the docs (and worked quite a bit in Bishop, which predates Liberator and - if you notice the pun - inspired Rook). On Mon, Aug 24, 2015 at 8:38 PM, Daniel Compton < daniel.compton.li...@gmail.com> wrote: > Hi Howard > > Thanks for sharing this. Can you comment briefly on how this compares and > contrasts to Liberator? I know they're not exactly the same, but they're > definitely in the same neighbourhood. > > On Tue, Aug 25, 2015 at 3:31 AM Howard Lewis Ship <hls...@gmail.com> > wrote: > >> Rook is a set of middleware and handlers to enable metadata-based routing >> for Ring web applications. >> >> The intention is to expose a Clojure namespace as a web service resource; >> there’s a default mapping of HTTP verbs and paths to function names; these >> can be extended or overridden by metadata on the functions in the namespace. >> >> The end result is that a compliant web service resource can be created in >> very little code. >> >> Rook also supports Swagger 2.0: a detailed JSON description of your web >> service is generated directly from the functions and metadata. >> >> Recent changes: >> >> * Described more of the APIs using Prismatic Schema >> * Added ability to reuse the argument resolution logic outside of >> endpoint functions >> * Many improvements to the Swagger 2.0 description support >> >> https://github.com/AvisoNovate/rook >> >> -- >> Howard M. Lewis Ship >> >> Looking for Clojure engagements: coding, architecture, mentoring & more! >> >> Creator of Apache Tapestry >> >> (971) 678-5210 >> http://howardlewisship.com >> @hlship >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google Groups >> "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to clojure+unsubscr...@googlegroups.com. >> For more options, visit https://groups.google.com/d/optout. >> > -- > -- > Daniel > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- Howard M. Lewis Ship Starting with WalMart Labs on Sep 28th! Creator of Apache Tapestry (971) 678-5210 http://howardlewisship.com @hlship -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.