ClojureRemote 17 — Hoplon Index & Routing

flyboarder
degree9
Published in
1 min readFeb 9, 2017
ClojureRemote 17

This post is one of many, and will cover topics discussed at ClojureRemote.

Our client app is now connected to the server, is able to store data and communicate via real-time events, not too bad. Now we move on to the real substance of our client application.

https://gist.github.com/flyboarder/953a9109b32146909dfed17222e5fdbd

Hoplon will generate it’s own entry-point for us when we use the page macro as seen above. We then setup the default page head, reference any stylesheets needed and configure the body content with some routing.

Our routing is provided by bidi, as well as the community contributed hoplon/brew package. We create a route list matching bidi’s pattern and return pairs which correspond valid routes to hoplon elements. Hoplon provides a set of abstractions on top of standard HTML elements, which make them much more clojure-ish and provides a means of responding to events which can make changes to application state.

Client application with routing in under 20 lines of code. Yes please!

--

--