babashka/examples/httpkit_server.clj

16 lines
501 B
Clojure
Raw Normal View History

2020-09-23 12:32:11 +00:00
(ns examples.httpkit-server
(:require [clojure.pprint :refer [pprint]]
[org.httpkit.server :as server]))
(defn handler [req]
(let [reply (str (slurp "examples/httpkit_server.clj")
"---\n\n"
(with-out-str (pprint (dissoc req
:headers
:async-channel))))]
{:body reply}))
(server/run-server handler {:port 8090})
@(promise) ;; wait until SIGINT