This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-07-06
Channels
- # aws-lambda (8)
- # beginners (49)
- # boot (13)
- # braveandtrue (2)
- # cider (12)
- # cljs-dev (15)
- # cljsrn (2)
- # clojure (143)
- # clojure-italy (8)
- # clojure-nl (17)
- # clojure-spec (22)
- # clojure-uk (21)
- # clojurescript (145)
- # code-reviews (1)
- # cursive (33)
- # data-science (14)
- # datomic (25)
- # emacs (3)
- # events (1)
- # fulcro (48)
- # graphql (1)
- # onyx (15)
- # perun (5)
- # play-clj (2)
- # protorepl (1)
- # re-frame (27)
- # remote-jobs (3)
- # ring (3)
- # rum (7)
- # shadow-cljs (87)
- # specter (4)
- # test-check (14)
- # testing (2)
- # tools-deps (9)
In case anyone was wondering, here is how one could define REST routes along with a custom interceptor with the graphql routes using lacinia pedestal:
(defn healthz
[params]
(hash-map :body "OK" :status 200))
(defrecord Server [schema-provider server]
component/Lifecycle
(start [this]
(assoc this :server
(let [schema (:schema schema-provider)
options {:graphiql true
:interceptors (-> (lp/default-interceptors schema {})
(lp/inject interceptors/authenticate-token :before ::lp/query-executor))}]
(-> schema
(lp/service-map options)
(update ::http/routes conj ["/healthz" :get healthz :route-name :healthz])
http/create-server
http/start))))
(stop [this]
(http/stop server)
(assoc this :server nil)))
🙏 4