Extend Ring
Ring provides a simple base for handling the HTTP request and response cycle. We’ll now look at several libraries that provide many additional utility functions that extend the functionality of Ring.
As we saw earlier, the Ring stack consists of a chain of middleware functions. Each function accepts the request map, modifies it in some way, and then passes it on to the next function in the chain. The middleware functions have to be wrapped in order of dependency. For example, session-based authentication relies on the presence of a session, and the session middleware must run before it to make the session available.
A library called ring-defaults provides a standard set of middleware that’s useful for typical web applications. ...
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.