Creating the Application

To create the application we’ll open Eclipse and then select a new Leiningen project. We’ll set the project name to picture-gallery and change our profile from default to compojure-app. If needed, please refer to Chapter 1, Getting Your Feet Wet, for more details on how to complete this step. We’ll use PostgreSQL as our database, so we’ll need to add the necessary dependencies to our project. Once your project has been initialized, open the project.clj and add the postgresql, clojure.java.jdbc, and lib-noir dependencies.

picture-gallery-a/project.clj
 
[postgresql/postgresql ​"9.1-901.jdbc4"​]
 
[org.clojure/java.jdbc ​"0.2.3"​]
 
[lib-noir ​"0.8.2"​]

Since we’re using lib-noir, we have to add its middleware to our handler ...

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.