This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-03-27
Channels
- # announcements (3)
- # aws (7)
- # babashka (11)
- # beginners (96)
- # clojure (15)
- # clojure-europe (9)
- # clojure-germany (2)
- # clojure-italy (1)
- # clojure-nl (3)
- # clojure-poland (3)
- # clojure-serbia (1)
- # clojurescript (13)
- # depstar (28)
- # fulcro (34)
- # graalvm (5)
- # honeysql (5)
- # malli (11)
- # off-topic (27)
- # pathom (9)
- # polylith (74)
- # portal (10)
- # re-frame (13)
- # releases (1)
- # ring (8)
- # shadow-cljs (3)
- # spacemacs (10)
- # tools-deps (8)
Total beginner question: In an example project I am testing I lose the REPL after having evaluated (run-jetty …)
. The server seems to work fine, but no more REPL for me. Anyone have a hint for me what I should check to see why it locks up like this?
Doesn't that block? If you're evaling from the repl, then the run-jetty
will block the REPL thread
@pez there's a :join?
option for run-jetty: https://ring-clojure.github.io/ring/ring.adapter.jetty.html
Thanks! It was the :join?
option I had missed. I took inspiration from the example @dharrigan provided and now have this:
(def ^:private server-ref (atom nil))
(defn start! []
(if-let [server @server-ref]
(log/warn "Server already running? (stop!) it first.")
(do
(api/init)
(reset! server-ref
(run-jetty api/app
{:port (Integer/valueOf
(or (System/getenv "port")
"6003")
10)
:join? false})))))
(defn stop! []
(if-let [server @server-ref]
(do (api/destroy)
(.stop server)
(reset! server-ref nil))
(log/warn "No server")))
(defn -main [& _args]
(start!))
Please let me know if it looks crazy to you. 😃