This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-06-19
Channels
- # aws-lambda (1)
- # bangalore-clj (4)
- # beginners (66)
- # boot (13)
- # cider (9)
- # cljs-dev (44)
- # cljsjs (3)
- # clojure (181)
- # clojure-austin (2)
- # clojure-greece (6)
- # clojure-italy (2)
- # clojure-russia (64)
- # clojure-sg (1)
- # clojure-spec (68)
- # clojure-uk (60)
- # clojurescript (66)
- # conf-proposals (12)
- # cryogen (1)
- # cursive (3)
- # datomic (44)
- # graphql (1)
- # hoplon (2)
- # jobs (2)
- # jobs-discuss (3)
- # keechma (2)
- # liberator (6)
- # luminus (2)
- # nyc (1)
- # off-topic (92)
- # om (10)
- # onyx (17)
- # parinfer (39)
- # pedestal (8)
- # proton (11)
- # re-frame (110)
- # reagent (2)
- # remote-jobs (11)
- # ring-swagger (9)
- # rum (2)
- # sql (2)
- # test-check (6)
- # untangled (138)
Why are the routes quoted to begin with? I’m working from the leiningen template. https://github.com/pedestal/pedestal/tree/master/service-template/src/leiningen/new/pedestal_service
@henrik, I’ve not looked at the impl for map-based routes so I can’t comment on them. My preference is the tabular routing syntax. I find them much easier to grok.
Fair enough. In the case of tabular routes, the back tick sits on the routing function itself. In the “hello world” guide, there’s no back tick:
(def routes
(route/expand-routes
#{["/greet" :get respond-hello :route-name :greet]}))
In the template, the routing is split between service.clj
:
;; Tabular routes
(def routes #{["/" :get (conj common-interceptors `home-page)]
["/about" :get (conj common-interceptors `about-page)]})
and server.clj
:
(-> service/service ;; start with production configuration
(merge {…
::server/routes #(route/expand-routes (deref #'service/routes))
…}})
What’s the deal with the back-ticks in the first file and the deref
in the other? Why are they there and what do they do?The backticks in service.clj
lead to fully qualified symbols that get resolved here: https://github.com/pedestal/pedestal/blob/master/interceptor/src/io/pedestal/interceptor.clj#L49