plexus / chestnut

Application template for Clojure + ClojureScript web apps
Eclipse Public License 1.0
1.32k stars 99 forks source link

(go) has to be called every time a route is changed. #251

Open zendevil opened 4 years ago

zendevil commented 4 years ago

Even when the handler is loaded using C-c C-c or C-c C-e, (go) must be used in order for the handler's update to take effect. Adding wrap-reload in config.clj doesn't solve the issue either.

saidone75 commented 4 years ago

Hi @zendevil , I solved that by wrapping my routes directly in routes.clj

(def my-routes
  (routes
   (resources "/")
   (GET "/slackware" _ (redirect "http://slackware.com"))
   (ANY "*" _
        (-> "public/index.html"
            io/resource
            io/input-stream
            response
            (assoc :headers {"Content-Type" "text/html; charset=utf-8"})))))

(defn home-routes [endpoint]
  (wrap-reload #'my-routes))

then you just to have to re-evaluate my-routes form.