Define the Routes with Reitit
Reitit is a general purpose routing library that can be used to provide routing on top of Ring as well as for client-side routing, as we’ll see later on. It provides a way to associate handler functions with a URL and an HTTP method.
We already saw some examples of routing using Reitit when we built our first application in Chapter 1, Getting Your Feet Wet. Now let’s take a closer look at the functionality it provides. First, add it as a dependency in the ring-app project.
| :dependencies [[org.clojure/clojure "1.10.1"] |
| [metosin/muuntaja "0.6.7"] |
| [metosin/reitit "0.5.11"] |
| [metosin/ring-http-response "0.9.1"] |
| [ring "1.8.2"]] |
With the dependency in place, let’s update the ...
Get Web Development with Clojure, 3rd 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.