Liking cljdoc? Tell your friends :D

Skir - an over-simplified HTTP Node.js server toolkit

in ClojureScript.

Usage

Clojars Project

[mvc-works/skir "0.0.8-a1"]

WIP...

(require '[skir.core :as skir])

(defn on-request! [req-edn res]
  {:code 200
   :message "OK"
   :headers {:Content-Type "application/edn"}
   :body {:message "Hello World!"}})

(skir/create-server! #(on-request! %1 %2))

Core logic:

(cond
  (map? response) (write-response! res response)
  (fn? response) (response (fn [response-data] (write-response! res response-data)))
  (promise? response) (.then response (fn [result] (write-response! res result)))
  (chan? response) (go (write-response! res (<! response)) (close! response))
  (= response :effect) (comment "Done with effect")
  :else (do (println "Response:" response) (throw (js/Error. "Unrecognized response!"))))

License

MIT

Can you improve this documentation? These fine people already did:
jiyinyiyong & ChenYong
Edit on GitHub

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close