Fork me on GitHub
#reitit
<
2021-07-23
>
zxspectrr15:07:05

hi, I'm quite new to clojure and reitit so apologies if this is a stupid question. I've defined some routes here:

(def app
  (ring/ring-handler
    (ring/router
      ["/api" {:middleware [[wrap-json-response]
                            [param/parameters-middleware]]}
       ["/ping" {:get (fn [_] (response "hi there"))
                 :name ::ping}]
       ["/stock"
        {:get #'stock-clojure.stock-handler/find-stock}]
       ["/stock/:dealer-id/:index"
        {:get stock-clojure.stock-handler/find-nth-stock-item}]
       ["/users" {:get stock-clojure.users-handler/find-all-users
                  :post (fn [_] (response "hi there"))}]
       ["/users/:id" {:get stock-clojure.users-handler/find-user}]])
    (constantly {:status 404, :body "not found"})))
this bit is invalid: {:get #'stock-clojure.stock-handler/find-stock} I was trying to find a way to reload my route behaviour without having to re-evaluate this code that contains the route definition. Further down i used the # trick
(jetty/run-jetty #'app {:port 5000, :join? false})
But it doesn't let me do the same thing for functions as I can for variables. Is there a way to avoid having to reload both the file that contains the route definition as well as the file that contains the route behaviour?