Web Development with Clojure, Third Edition: Issue adding Reitit controllers pg 210

I encountered an error when adding the controllers to app-routes defined in app.cljc.

The code in the book references the controllers with var reader macro as shown below:

(defn app-routes []
  ;; ...
  ["/"
     (merge
       {:name ::home}
       #?(:cljs
       {:controllers #'home/home-controllers
        :view #'home/home}))]
  ;; ...

When i view the page with the code above, the js doesn’t load and the error thrown is:

core.cljs:1251 Uncaught Error: #'guestbook.views.home/home-controllers is not ISeqable

I think I resolved this by removing the var reader macro, just referencing home/home-controllers.

Is this the correct solution or could there be something I’m missing elsewhere?

2 Likes

That is the correct solution.
Vars are usually used for reloading purposes, but they don’t work in this case.
Sorry for the oversight and resulting confusion!
This will be addressed in the next release.
Thanks for the heads up, and thanks for reading!

1 Like