This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-07-23
Channels
- # announcements (1)
- # aws (13)
- # babashka (31)
- # beginners (102)
- # calva (46)
- # cider (16)
- # clj-kondo (1)
- # cljs-dev (3)
- # clojars (1)
- # clojure (396)
- # clojure-argentina (1)
- # clojure-australia (4)
- # clojure-europe (64)
- # clojure-nl (2)
- # clojure-uk (8)
- # clojurescript (20)
- # conjure (5)
- # cursive (4)
- # datomic (15)
- # emacs (48)
- # graalvm (69)
- # graalvm-mobile (1)
- # jobs (4)
- # jobs-rus (1)
- # lsp (6)
- # malli (15)
- # meander (2)
- # observability (11)
- # off-topic (10)
- # pathom (2)
- # portal (4)
- # re-frame (19)
- # reitit (1)
- # remote-jobs (3)
- # sci (1)
- # shadow-cljs (51)
- # tools-deps (11)
- # vim (12)
- # xtdb (13)
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?