Fork me on GitHub
#reitit
<
2018-07-18
>
ikitommi10:07:59

@delaguardo r/routes returns in future just the path + route data tuples, so the code is bit simpler. [metosin/reitit "0.1.4-SNAPSHOT"]. Wrote a small guide on composing routers: https://metosin.github.io/reitit/advanced/composing_routers.html

delaguardo10:07:51

thanks! will try it later today. So far Iā€™m using your suggestion and all my tests are green.

šŸ‘ 4
valerauko14:07:22

how am i supposed to handle "conflicting" routes? eg both api/users/:id and api/users/some-action should work

valerauko14:07:38

i know that :id has to be a number

valerauko14:07:07

i'm aware that "this isn't good" but it's an existing api i have to comply with

ikitommi15:07:52

@vale you can disable the conflict resolution, with {:conflicts nil} router option. Conflicting route tree will use linear-router, and the route ordering matters.

valerauko15:07:20

would it work if i logged it?

ikitommi15:07:25

sure, it's a function, logging is good

valerauko15:07:18

would the example i gave above work?

valerauko15:07:36

or would /some-action then go into /:id ?

valerauko15:07:34

oh all right i see, that's what you mean by ordering matters

valerauko15:07:47

{:conflicts nil}didn't seem to work though, it still died with an exception -- but {:conflicts identity} silenced it all right

valerauko15:07:53

maybe i did something wrong?

ikitommi15:07:36

I'll check that out later.

šŸ™ 4