reload - Reloading Clojure Code/Routes - Issue with using the symbol vs. var -


i'm new clojure, , trying few simple web routes set up. want routes reload associated code in development, not in production.

i able work using var's routes, not actual symbols. can explain if i'm doing wrong? if not, why 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 , #'routes/html-routes above).

in manner described in more detail in answer, server ends capturing route functions when passed in, , if provide var, ensure server uses updated definitions.

this considered normal way provide route or handler function during development, can see updated definitions without having restart web server process.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

datatable - Matlab struct computations -