This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-26
Channels
- # admin-announcements (1)
- # beginners (12)
- # cider (2)
- # cljs-dev (6)
- # cljsrn (4)
- # clojure (123)
- # clojure-austin (10)
- # clojure-brasil (1)
- # clojure-canada (21)
- # clojure-conj (5)
- # clojure-dev (8)
- # clojure-gamedev (42)
- # clojure-russia (121)
- # clojure-sanfrancisco (2)
- # clojure-spec (25)
- # clojure-uk (36)
- # clojurescript (195)
- # clojutre (3)
- # cursive (43)
- # datomic (6)
- # defnpodcast (2)
- # dirac (14)
- # emacs (2)
- # ethereum (2)
- # events (2)
- # funcool (6)
- # hoplon (76)
- # jobs (1)
- # kekkonen (9)
- # lein-figwheel (1)
- # leiningen (4)
- # mount (6)
- # off-topic (5)
- # om (2)
- # onyx (91)
- # pedestal (2)
- # protorepl (14)
- # re-frame (22)
- # reagent (20)
- # rethinkdb (1)
- # ring (2)
- # schema (3)
- # sfcljs (3)
- # spacemacs (15)
- # specter (12)
- # testing (1)
- # yada (63)
@vijayakkineni by design, Kekkonen doesn’t make it easy to split parameters into multiple parameter-sets. Having separate query-, header- & body-params makes it harder to use the handler via other channels. We are using Sente & websockets in few projects, where the data is just passed in as a tuple [:search {:type :similar, :linked? false, :origin {}}]
.
1) read the :request
directly in the handler:
(defnk ^:command search
"Searches a patient"
{:responses {:default {:schema types/PatientSearchResponse}}}
[[:request
[:query-params type :- (:type PatientSearchRequest}, linked :- (:linked PatientSearchRequest)]]
[:data origin :- (:origin PatientSearchRequest)]]
(success data))
2) create a new handler-type into ring-handler. You can set how the request-paramters are mapped into data. See example on the CQRS-api: https://github.com/metosin/kekkonen/blob/master/src/kekkonen/cqrs.clj#L50-L59
the CQRS-style is just an example, we are using a modified version of that (will push that into core at some point).
{:command {:methods #{:post}
:parameters {[:data] [:request :body-params]
[:query] [:request :query-params]}}}
@ikitommi: thank you that helps.