Skip to content

Latest commit

 

History

History
31 lines (24 loc) · 1.46 KB

README.md

File metadata and controls

31 lines (24 loc) · 1.46 KB

ephemeral-server

One-function library that helps to open ephemeral servers.

Build status Clojars badge Clojars downloads cljdoc badge GitHub license GitHub issues

In your project, require:

(require '[piotr-yuxuan.ephemeral-server :as ephemeral-server])

You now may open an ephemeral server that will live a short but beautiful life ✨.

(let [port (atom nil]
  (with-open [_ (ephemeral-server/open port ["/ping" {:get (constantly {:body "expected"})}])]
    ;; Now @port is set to its actual value.
    (->> (http/get (format "http://localhost:%s/ping" @port))
         deref
         :body
         slurp)))