1

I am creating routes for:

/

/*.jpg

/*.png

in pedestal.io.

My bad code, that returns boot.user=> clojure.lang.ExceptionInfo: route conflict, is this

(def routes
  (route/expand-routes
    #{
      ["/" :get [coerce-body content-neg-intc respond-main]
       :route-name :main]
      ["/*.jpg" :get [(ringmid/resource "/")]
       :route-name :jpg]
      ["/*.png" :get [(ringmid/resource "/")]
       :route-name :png]
      }))

Any idea how to improve it?

trzczy
  • 1,325
  • 2
  • 18
  • 43
  • Under 'Table syntax' in [this page](http://pedestal.io/reference/routing-quick-reference), I says **When multiple routes use the same path, they must differ by both verb and route name.**. Do you think that might be why? (If so, I guess you should use if possible another verb? Or make your route `"/jpg/:name"` and `"/png/:name"` if you want to use `get` for both?) – Julien Rousé Jan 25 '19 at 14:05
  • Also look at [catch-all](http://pedestal.io/guides/defining-routes#_catch_all_parameters), it seems that if you write `["/*.jpg" :get [(ringmid/resource "/")]` it is transform as `{:path-params {:jpg "whateverwasusedhere"}}`. It does not work as a regular expression. Maybe use [constraints](http://pedestal.io/guides/defining-routes#_constraints) to accomplish what you are aiming – Julien Rousé Jan 25 '19 at 14:23

0 Answers0