Use Compojure-api

Having a well-documented and discoverable service API is key to building a stable and maintainable application. Let’s see how Compojure-api allows us to achieve this goal. The Schema library is used to define the Swagger-style RESTful service end points.[56][57] Schema provides us with a number of benefits, such as documentation for the structure of the data, input validation, and optional data coercion. Couple this with the Ring-Swagger library and we can automatically generate an interactive documentation page for our API.[58]

Let’s see how this all works in practice by working through a new project. The goal of our project will be to entertain the users with an endless stream of cat pictures. Luckily for us, a public API ...

Get Web Development with Clojure, 2nd Edition 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.