Creating the Project

In this section we’ll cover how to create a simple application that serves static resources, provides basic session management, and handles JavaScript Object Notation (JSON) operations.

First let’s create a new application called liberator-service using the compojure-app template.

 
lein new compojure-app liberator-service

Once the application is created, add Liberator and Cheshire dependencies to our project.clj dependencies vector:[40]

 
:dependencies
 
[ ​..​​.
 
[liberator ​"0.11.0"​]
 
[cheshire ​"5.3.1"​]]

Cheshire is a fast and easy-to-use JSON parsing library. We’ll use it for parsing the requests from the client and generating the responses.

At this point, we should be able to start up the read-evaluate-print ...

Get Web Development with Clojure now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.