I'm new to Clojure, and trying to get a few simple web routes set up. I want the routes to reload all associated code in development, but not in production.
I was only able to get this to work using the var's for the routes, not the actual symbols. Can someone explain if I'm doing this wrong? If not, why is the var required?
(def app-handler
(let [formats [:json-kw :edn :yaml-kw :yaml-in-html :transit-json :transit-msgpack]
wrapped-api (wrap-restful-format #'routes/api-routes :formats formats)
combined-routes (compojure.core/routes wrapped-api #'routes/html-routes)
with-defaults (wrap-defaults combined-routes api-defaults)]
(if (is-dev?)
; Development
(wrap-reload with-defaults)
; Production
with-defaults)))
(Note #'routes/api-routes
and #'routes/html-routes
above).
var
have any kind of meaningful performance impact vs. some other method using a de-referenced value? – Brandon