This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-07
Channels
- # admin-announcements (5)
- # aws (2)
- # boot (313)
- # cider (69)
- # cljsfiddle (18)
- # cljsrn (17)
- # clojars (6)
- # clojure (121)
- # clojure-austin (4)
- # clojure-bangladesh (4)
- # clojure-colombia (2)
- # clojure-dusseldorf (17)
- # clojure-japan (1)
- # clojure-russia (65)
- # clojure-sg (4)
- # clojurescript (94)
- # community-development (6)
- # core-matrix (2)
- # cursive (2)
- # data-science (6)
- # datomic (28)
- # hoplon (4)
- # jobs (1)
- # jobs-discuss (1)
- # keechma (15)
- # ldnclj (2)
- # off-topic (6)
- # om (140)
- # om-next (1)
- # onyx (47)
- # parinfer (11)
- # re-frame (13)
- # reagent (4)
- # spacemacs (7)
- # specter (7)
- # yada (18)
@roberto this defines the defaults for the route pattern. So, the first route definition matches either "foo" => {:page "foo"}
or "" => {:page "home"}
so, would just specifying “home” work?
:routes [“home” “:page/:slug” “:page/:slug/:action”]
I think you could specify it like this :routes [["" {:page "home"}]]
but I'm not sure, I'll have to write a test for that
basically the idea is that you have a pattern and when you pass in the data it will try to find the best route match based on the data + pattern defaults
but in the place my order app
it has 3 urls that are matched by that route (home, restaurants and order-history)
so it makes sense to define the route like that
it will calculate the score for each route and then pick the best one https://github.com/keechma/keechma/blob/master/src/keechma/router.cljs#L91-L103
oh, so it converts them to a set, cool. I was worried about having a long list of routes and the application slowing down because of that.
yeah, I've used CanJS for years (and the router is ported from CanJS) and usually I would have way less than 10 route patterns
you don't really need that much when you just translate data from one format to another
+ I really like to use query params in some cases