Fork me on GitHub
#babashka
<
2021-05-16
>
jaide03:05:52

Anyone have an example of reagent.dom.server working in babashka?

jaide05:05:48

Hehe nevermimd, reagent.dom.server is a cljs file 😛

dabrazhe17:05:48

Has someone managed to run a ring or httpkit server with bb in docker? I want to try it on aws fargate.

borkdude17:05:42

Yes, httpkit is built in so that shouldn't be a problem :)

dabrazhe21:05:29

This will likely help, will have a look. Now to create the docker file : )

dabrazhe21:05:24

Which version of httpkit is built in bb? I can't seem to be able to stop the server with /server-stop! getting some protocol error.

borkdude21:05:12

@U96LS78UV I think the newest one. I'm getting the same error with clojure:

$ clojure -Sdeps '{:deps {http-kit/http-kit {:mvn/version "2.5.3"}}}' -M /tmp/httpkit.clj
Syntax error (IllegalArgumentException) compiling at (/tmp/httpkit.clj:3:1).
No implementation of method: :-server-stop! of protocol: #'org.httpkit.server/IHttpServer found for class: clojure.lang.AFunction$1

borkdude21:05:54

@U96LS78UV It seems it works like this:

(def server (srv/run-server (fn [_])))
(server)

borkdude21:05:27

(def server (srv/run-server (fn [_])))
(server :timeout 100)

borkdude21:05:07

It seems the return value depends on:

If :legacy-return-value? is
    true  (default)     ; Returns a (fn stop-server [& {:keys [timeout] :or {timeout 100}}])
    false (recommended) ; Returns the HttpServer which can be used with `server-port`,
                        ; `server-status`, `server-stop!`, etc.

grazfather17:05:35

How can I get the CWD easily in bb?

lispyclouds17:05:59

(System/getProperty "user.dir")