keechma

Keechma stack. Mention @U050986L9 or @U2J1PHYNM if you have any questions
mihaelkonjevic 2016-03-07T07:16:45.000049Z

@roberto this defines the defaults for the route pattern. So, the first route definition matches either "foo" => {:page "foo"} or "" => {:page "home"}

roberto 2016-03-07T14:28:50.000051Z

so, would just specifying “home” work?

:routes [“home” “:page/:slug” “:page/:slug/:action”]

mihaelkonjevic 2016-03-07T14:34:21.000052Z

I think you could specify it like this :routes [["" {:page "home"}]]

mihaelkonjevic 2016-03-07T14:35:06.000055Z

but I'm not sure, I'll have to write a test for that :simple_smile:

mihaelkonjevic 2016-03-07T14:35:48.000056Z

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

mihaelkonjevic 2016-03-07T14:38:00.000057Z

but in the place my order app

mihaelkonjevic 2016-03-07T14:38:19.000058Z

it has 3 urls that are matched by that route (home, restaurants and order-history)

mihaelkonjevic 2016-03-07T14:38:27.000059Z

so it makes sense to define the route like that

roberto 2016-03-07T14:39:51.000060Z

when trying to locate a route, it does so sequentially?

mihaelkonjevic 2016-03-07T14:42:19.000061Z

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

roberto 2016-03-07T14:46:36.000063Z

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.

roberto 2016-03-07T14:46:54.000064Z

but then again, that shouldn’t be happening (writing an app with hundreds of routes)

mihaelkonjevic 2016-03-07T14:49:57.000065Z

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

mihaelkonjevic 2016-03-07T14:50:17.000066Z

you don't really need that much when you just translate data from one format to another

mihaelkonjevic 2016-03-07T14:50:28.000067Z

+ I really like to use query params in some cases