Quickly create a REST API with Liberator
Liberator is a Clojure library for developing resources for REST web services. REST is an abbreviation for Representational State Transfer and it's an architectural style for designing web network applications.
Liberator was inspired by Erlang's Webmachine. Webmachine was developed by Justin Sheehy, who is the CTO of Basho Technologies, has developed Riak. Webmachine is a RESTful toolkit for writing well-behaved HTTP applications and helping developers to handle the complexities of an HTTP-based application.
Similarly, using Liberator makes web API developments simpler but provides HTTP rich features such as content negotiation and caching.
Getting ready
Before we learn Liberator, we will create a new project named liberator-example
. To do this, use lein new
to create a new Clojure project:
$ lein new liberator-example
Then, we will modify the generated project.clj
to make use of Liberator. In addition to a Liberator library, we need the ring
and compojure...