Book Image

Clojure Web Development Essentials

By : Ryan Baldwin
Book Image

Clojure Web Development Essentials

By: Ryan Baldwin

Overview of this book

Table of Contents (19 chapters)
Clojure Web Development Essentials
About the Author
About the Reviewers

Creating your first page

This is a tad misleading. Instead of creating a brand new page, we're going to modify the existing home page and cover a couple of things about Selmer along the way. But first, we need to determine where the HTML is for the home page.

Recall that our hipstr.handler/app uses three Ring handlers: home-routes, base-routes, and test-routes. We know that test-routes doesn't handle the home page because we just created it, and we can see that base-routes is defined in hipstr.handler and is responsible for handling "HTTP 404: Page Not Found" responses and requests to our static resources. This leaves the home-routes, which in hindsight, is pretty obvious given the name.

The home-routes handler is defined in the hipstr.routes.home namespace (/src/hipstr/routes/home.clj). The namespace defines two routes and two functions responsible for rendering each respective route's response. Notably, we see the following code right near the bottom:

(GET "/" [] (home-page))

This route serves...