Fork me on GitHub
#reitit
<
2019-11-20
>
Aleks11:11:15

Hi! I am trying to move to reitit and am having trouble: “Router contains conflicting route paths”. Currently I have the following routes: “users” “users/active” “users/archived” “users/:id” “users/:id/settings” How can I handle this case with reitit?

sudakatux11:11:06

have you tried

sudakatux11:11:37

["/users"
["/active"......]
["/archived"....]]

Aleks11:11:23

yes, but if you also add a wildcard (:id) you will get a canflict

ikitommi11:11:22

@zelark you can add {:conflicts nil} to router options to allow the conflict.

Aleks11:11:36

@ikitommi thanks, didn’t know about it

Aleks11:11:39

But is there some way to get the similar result without using {:conflicts nil}? Let’s say we have

[/users/:filter]
[/users/:id]
where :filter is always a string, and :id is always a number.

ikitommi11:11:32

@zelark no, there is no selection of routes based on parameter types. If you disable the conflict resolution, the conflicting routes are matched in order and the first match wins.

Aleks11:11:23

thanks again