This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-28
Channels
- # babashka (48)
- # babashka-sci-dev (7)
- # beginners (123)
- # calva (32)
- # cider (5)
- # clara (20)
- # clj-kondo (3)
- # cljdoc (2)
- # cljs-dev (1)
- # clojure (113)
- # clojure-dev (5)
- # clojure-europe (65)
- # clojure-norway (23)
- # clojure-spec (4)
- # clojure-uk (4)
- # clojurescript (33)
- # cursive (3)
- # datalevin (39)
- # datomic (2)
- # emacs (14)
- # events (1)
- # fulcro (10)
- # graphql (5)
- # humbleui (2)
- # integrant (4)
- # introduce-yourself (3)
- # jobs (1)
- # jobs-discuss (11)
- # kaocha (26)
- # leiningen (6)
- # malli (24)
- # nbb (2)
- # off-topic (69)
- # pathom (77)
- # podcasts-discuss (2)
- # reitit (8)
- # remote-jobs (2)
- # sci (17)
- # scittle (8)
- # squint (1)
- # xtdb (43)
I’m struggling to create a basic retitit-ring
app that works with wrap-reload
— tried a lot of permutations but file changes to "1234"
aren’t reflected in a browser refresh. Can you see what’s wrong here?
(ns
(:require
[reitit.ring :as ring]))
(def app
(ring/ring-handler
(ring/router
[["/"
{:get {:handler
(constantly {:body "1234"
:headers {"Content-Type" "text/html"}
:status 200})}}]])
(ring/create-default-handler)))
;; separate file
(ns hello.server
(:require
[reitit.ring :as ring]
[ :refer [app]]
[ring.middleware.reload :refer [wrap-reload]]
[ring.adapter.jetty :refer [run-jetty]]))
(defn -main [& _args] (run-jetty (ring/routes (wrap-reload #'app)) {:join? false :port 3000}))
Did you check this out already? https://cljdoc.org/d/metosin/reitit/0.5.18/doc/advanced/dev-workflow
Thanks @U6N4HSMFW, I’ll try to grok this
Yeah, hope there are some clues! Though I think that wrap-reload
should also ‘just work’ because it reloads the whole namespace which should cause the route-tree to be rebuilt
I’d be happy to (wastefully) reload everything if I could get it to work! :woman-shrugging:
Think I got it. I have nonstandard :source-dirs
! wrap-reload
defaults to src
only. Thank you 🙏
https://github.com/ring-clojure/ring/blob/master/ring-devel/src/ring/middleware/reload.clj#L34