Routing and HTML5 history
So, at this point, our todo application has some interesting features, but it's very bare bones. It's also literally a single page application, but, of course, real applications typically involve multiple pages. Let's extend ours to have multiple pages.
We've already included bidi
as a dependency of the application, and we've already used it on the server side. Now, we will use it to do client-side routing. Here, routing refers to the process of determining which page to display, based on the contents of the URL. Let's get started.
First, we'll modify project.clj
and add [venantius/accountant "0.1.7"]
to the :dependencies
vector. Then, let's add [accountant.core :as accountant]
to the om-tut.core ns
declaration:
(ns om-tut.core ...
Get Learning ClojureScript 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.