This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-07-12
Channels
- # admin-announcements (2)
- # aleph (2)
- # arachne (16)
- # beginners (33)
- # boot (20)
- # bristol-clojurians (6)
- # capetown (4)
- # cider (50)
- # clojure (74)
- # clojure-austin (4)
- # clojure-canada (1)
- # clojure-china (2)
- # clojure-czech (1)
- # clojure-greece (1)
- # clojure-poland (4)
- # clojure-quebec (5)
- # clojure-russia (5)
- # clojure-spec (34)
- # clojure-uk (45)
- # clojurescript (131)
- # cursive (4)
- # datascript (2)
- # datomic (9)
- # editors (2)
- # emacs (2)
- # hoplon (173)
- # jobs (5)
- # lein-figwheel (3)
- # leiningen (1)
- # off-topic (1)
- # om (44)
- # onyx (8)
- # proton (10)
- # re-frame (81)
- # reagent (23)
- # untangled (57)
- # vim (2)
- # yada (8)
https://groups.google.com/forum/#!topic/datomic/pZombLbp-tQ heads up as this may affect some users of yada.
in bidi, how can I combine to route descriptions like the one below:
(defn handler [sys]
["/" {"subscriptions" {:post (fn [req] {:status 200 :body "create-sub-handler"})}
["subscriptions/" :id] {:get (fn [req] {:status 200 :body "get-sub-handler"})
:delete (fn [req] {:status 200 :body "delete-sub-handler"})}}])
(defn handler' [sys]
["/" {"customers" {:post (fn [req] {:status 200 :body "create-sub-handler"})}
["customers/" :id] {:get (fn [req] {:status 200 :body "get-sub-handler"})
:delete (fn [req] {:status 200 :body "delete-sub-handler"})}}])
I guess the simplest way is to just strip the "/"
stuff and do something like ["/" (merge (handler {}) (handler' {}))]
hm but now I'm stuck trying to figure out how to add a catch all route:
(bidi/match-route [["/" {"subscriptions" {:post (fn [req] (prn sys) {:status 200 :body "create-sub-handler"})}
["subscriptions/" :id] {:get (fn [req] (prn sys) {:status 200 :body "get-sub-handler"})
:delete (fn [req] (prn sys) {:status 200 :body "delete-sub-handler"})}}]
[true #(rres/not-found "Not found")]]
"asds")
This throws. I tried a few variations of this but none worked.. 😝@martinklepsch: I don't know if it can help, but this is something similar I am doing:
"admin" {"" (fn [_] (ring/redirect "/admin/login.html"))
"/" (fn [_] (ring/redirect "/admin/login.html"))
true spa-response}
@richiardiandrea: this brought me on the right track I think, thanks!
awesome!
I really wish there would be better errors for stuff like this: java.lang.IllegalArgumentException: No implementation of method: :segment-regex-group of protocol: #'bidi.bidi/PatternSegment found for class: clojure.lang.PersistentArrayMap
Fighting a weird error that only occurs when using the routing table with make-handler
...