Skip to content

Instantly share code, notes, and snippets.

@emidln emidln/http.clj
Created Apr 7, 2015

What would you like to do?
(s/defrecord HttpKitWebServer
[server :- s/Fn
ip :- s/Str
port :- s/Int
app :- RingHandler]
(start [this]
(when server (server))
(let [nserver (httpkit/run-server (:app app)
{:port port
:ip ip
:max-body (pre (* 1024 1024 220))})]
(assoc this :server nserver)))
(stop [this]
(when server
;; do stuff before killing it
(dissoc this :server)))
(defnk new-httpkit-web-server
"Creates an HTTP-Kit component with an injectable ring handler"
[ip :- s/Str
port :- s/Int]
(map->HttpKitWebServer {:ip ip :port port}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.