This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-03-27
Channels
- # bangalore-clj (1)
- # beginners (27)
- # boot (16)
- # cider (14)
- # cljs-dev (94)
- # cljsrn (8)
- # clojure (229)
- # clojure-dev (5)
- # clojure-dusseldorf (6)
- # clojure-italy (8)
- # clojure-norway (8)
- # clojure-russia (22)
- # clojure-sanfrancisco (2)
- # clojure-spec (48)
- # clojure-uk (44)
- # clojurescript (47)
- # core-async (87)
- # cursive (43)
- # datascript (22)
- # datomic (20)
- # defnpodcast (5)
- # emacs (6)
- # hoplon (4)
- # jobs-rus (4)
- # keechma (2)
- # klipse (8)
- # leiningen (2)
- # luminus (2)
- # lumo (14)
- # om (38)
- # onyx (4)
- # overtone (3)
- # pedestal (41)
- # planck (72)
- # powderkeg (42)
- # proton (46)
- # protorepl (9)
- # reagent (9)
- # ring (47)
- # ring-swagger (5)
- # rum (7)
- # sql (22)
- # unrepl (1)
- # untangled (24)
- # vim (19)
- # yada (5)
Another bidi question incoming: I would like to share my routes with some clojurescript client code, either by sharing it in a cljc file, or passing the routes in the config map when the page initialises (haven’t decided yet). The only realistic way I see of achieving this is to have the handlers in the routes as keywords, and then have an extra lookup from the resource handlers from the keywords:
(def routes
{"/foo" :bar})
(def handler->fn
{:bar (yada "bar")})
(let [{:keys [handler]} (match-route route "/foo")]
(get handler->fn handler))
Is there a more concise way of doing this? Ideally I’d like to lose the handler->fn
. One idea I had was to use tag
and postwalk to extract the tags at the leaves.
Both approaches are fine. Quite sensible to use keywords and postwalk
Maybe others have other strategies.