2

I am defining a nested router with reitit and I want to create a v2 of the api. Currently the api is attached at /something/ and I have routes defined for /something/<long-id> so when I try to add a route for /something/v2 it gets matched as if v2 is an id. I have tried putting the definition for v2 first in the router definition in the hope it will be matched first, but it does not match.

(ring/router
  [["/v2/:part1/:part2" { :conflicting true }
    ["" { :get {:handler some-handler-v2}}]]
   ["/:part1/:part2" { :conflicting }
    ["" { :get {:handler some-handler}}]]
  ])

How can I configure reitit to understand that if the path segment is v2 use one config, and if it's anything else, use the other config?

Billy Moon
  • 57,113
  • 24
  • 136
  • 237

0 Answers0