This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-16
Channels
- # atom-editor (6)
- # babashka (31)
- # beginners (34)
- # calva (1)
- # cider (21)
- # clj-kondo (5)
- # cljsrn (2)
- # clojars (6)
- # clojure (35)
- # clojure-europe (3)
- # clojure-norway (2)
- # clojurescript (4)
- # conjure (10)
- # cursive (8)
- # data-science (78)
- # fulcro (23)
- # graphql (10)
- # helix (2)
- # luminus (1)
- # off-topic (50)
- # other-languages (1)
- # pathom (8)
- # re-frame (9)
- # reagent (9)
- # reitit (1)
- # rewrite-clj (6)
- # shadow-cljs (134)
- # tools-deps (53)
- # vscode (1)
- # xtdb (4)
How come home-routes
and service-routes
are defined as functions rather than values?
In src/clj/my-app/handler.clj
(mount/defstate app-routes
:start
(ring/ring-handler
(ring/router
[*(home-routes) ;* <-- Function call
*(service-routes)*]) ; <-- Function call
...))
In src/clj/my-app/routes/services.clj
(*defn* service-routes []
...)
Initially I thought it was necessary for the wrap-reload
ring middleware to work. But I tried changing the above to
In src/clj/my-app/handler.clj
(mount/defstate app-routes
:start
(ring/ring-handler
(ring/router
[(home-routes)
*service-routes*]) ; <-- Now just a value
...))
In src/clj/my-app/routes/services.clj
(*def* service-routes
...)
and wrap-reload still works, i.e. if you change something in service-routes
, save the services.clj file, and reload the page then the swagger-ui page gets updated.