Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
So far, you’ve seen several approaches to handling HTTP requests. As you saw, this is easy to do, with minimum ceremony (or even none—we didn’t have to create any XML files or other configuration files). We neatly wrote Clojure functions that were mapped to the incoming request, and any parameters either came in via named function arguments or as a convenient Clojure map.
The code you’ve seen here can be useful in creating HTTP APIs that allow Clojure programs to communicate and interact with other programs (written either in Clojure or any other language). The one thing we haven’t discussed so far is how to create UIs that can be used by end users. What you need to make this happen is a way to generate HTML, which can then be used to render your web UI. The previous sections used an interesting set of forms to generate HTML. Here’s an example from the section on Compojure: