Compojure is a routing library for Ring. It is particularly known for its
minimalism, making it suitable for smaller apps and APIs. It’s also a great
starting point for further exploring Clojure web development.
At the heart of any Clojure web stack you’ll find Ring. The Ring specification
defines key abstractions for representing HTTP requests and responses using
maps, providing a uniform interface to program to.
A Ring adapter is all you need to get started. It forms the bridge between a
HTTP server and your own Ring handler, which is a function that handles
Implementing Ring handlers from scratch is a great learning exercise, but in a
real world app you don’t want to reinvent the wheel. Every app will need some
kind of dispatching based on the requests URI path and HTTP method, like GET,
PUT, or POST. This is the job of a routing library, such as Compojure.
I’m starting a new blank project to build upon in this and coming episodes.
lein new compobook
Most leiningen templates don’t yet initialize Git, so it’s got to do that
manually before making any changes. This way it’s easy to see later on which
parts are provided by the template, and which were added by you.