Fork me on GitHub
#juxt
<
2019-11-02
>
cddr14:11:47

Hey Folks, Having a bit of trouble understanding the way that guarded routes work in bidi and I couldn't find any examples in the tests that would help me. Here's what I've got at the moment....

(def foo-routes
  ["/"
   [[:get [[["foos"] :get-foos]]]
    [:post [[["foos"] :post-foo]]]
    [:delete [[["foos"] :delete-foo]]]]])
This seems like it might be right since I can do...
(let [routes foo-routes]
  (bidi/path-for routes :post-foo))
=> "/foos"
However, if I then do (bidi/match-route foo-routes "/foos") I get nil. Adding :method :get to the call to match-route doesn't help as I thought it might.