extensible method for selecting constructor for handler
extensible method for selecting constructor for handler
(handler x)
constructs handler from
((handler [[:get "/hello" (constantly "hello")] [:post "/hello" (constantly "hello post")]]) {:method :post :route "/hello"}) => "hello"
constructs handler from ((handler [[:get "/hello" (constantly "hello")] [:post "/hello" (constantly "hello post")]]) {:method :post :route "/hello"}) => "hello"
(single-handler x)
constructs a single method handler
((single-handler [:get "/" (constantly {:status true})]) {:route "/"}) => {:status true}
(-> ((single-handler [:endpoint "/" {:functions {:add (fn [a b] (+ a b))}}]) {:route "/" :body (str {:id :add :args [1 2]})}) :body read-string) => (contains {:status :return, :data 3, :id :add})
constructs a single method handler ((single-handler [:get "/" (constantly {:status true})]) {:route "/"}) => {:status true} (-> ((single-handler [:endpoint "/" {:functions {:add (fn [a b] (+ a b))}}]) {:route "/" :body (str {:id :add :args [1 2]})}) :body read-string) => (contains {:status :return, :data 3, :id :add})
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close