This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-05-10
Channels
- # beginners (35)
- # cider (165)
- # cljsrn (18)
- # clojars (1)
- # clojure (141)
- # clojure-greece (2)
- # clojure-italy (11)
- # clojure-nl (1)
- # clojure-spec (21)
- # clojure-uk (89)
- # clojurescript (56)
- # community-development (3)
- # cursive (3)
- # data-science (55)
- # datomic (13)
- # emacs (12)
- # fulcro (31)
- # graphql (6)
- # jobs-discuss (35)
- # lein-figwheel (10)
- # mount (2)
- # off-topic (3)
- # onyx (22)
- # parinfer (4)
- # portkey (7)
- # re-frame (29)
- # ring-swagger (4)
- # shadow-cljs (37)
- # specter (9)
- # sql (30)
- # tools-deps (15)
- # vim (2)
- # yada (17)
I’ve just checked-out the edge
project — impressive array of examples there! I was wondering if I can hot-replace handlers when connected via nRepl? It seems like I have to call (reset)
every time something changes…
Say I want to redefined a resource by just evaluating a new get method or tweak some properties of the resource. I would like to just go to CIDER and eval the def
, and yada would pick it up on the next request.
(def hello-res
(resource {:id ::hi
:produces {:media-type "text/html"}
:methods {:get {:response #'hi-get}}
}))
I’ve found that doing #'hi-get
means I could re-define the hi-get
function. But I’d like to be able to re-defined the hello-res
resource as well.
For reference, here’s how hello-res
is used:
(defn -main []
(let [s (listener
["/"
[["hello" hello-res]
[true (as-resource nil)]]]
{:port 3000})]
(reset! server s)))
java.lang.ClassCastException: yada.resource.Resource cannot be cast to clojure.lang.IFn
at bidi.ring$eval39035$fn__39036.invoke(ring.clj:24)
at bidi.ring$eval39010$fn__39011$G__39001__39020.invoke(ring.clj:12)
at bidi.ring$make_handler$fn__39040.invoke(ring.clj:37)
at aleph.http.server$handle_request$fn__32260$f__17646__auto____32261.invoke(server.clj:157)
at clojure.lang.AFn.run(AFn.java:22)
at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
at manifold.executor$thread_factory$reify__17528$f__17529.invoke(executor.clj:44)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
New code is
(defn -main []
(let [s (listener
["/"
[["hello" #'hello-res]
[true (as-resource nil)]]]
{:port 3000})]
(reset! server s)))
We did this in the website, some variation of this works, @U050CTFRT