funcool / bide

A simple routing library for ClojureScript
BSD 2-Clause "Simplified" License
132 stars 20 forks source link

Url token Keywords with Hyphens #3

Closed AdamFrey closed 7 years ago

AdamFrey commented 7 years ago

Hi,

In the README, there is an example:

(def routes
  [["/auth/login" :auth/login]
   ["/auth/recovery/token/:token" :auth/recovery]
   ["/workspace/:project-uuid/:page-uuid" :workspace/page]])

but I've found that bide doesn't currently work with hyphenated keywords like :project-uuid and :page-uuid. so:

(r/match router "/workspace/abc/def")
=> nil

Avoiding hyphenated keywords seems to do what we want.

(def routes
  [...
   ["/workspace/:projectuuid/:pageuuid" :workspace/page]])

(r/match router "/workspace/abc/def")
=> [:workspace/page {:projectuuid "abc", :pageuuid "def"}]

I'm assuming you want bide to be able to use hyphenated url keywords, so I think you'll have to change the parser regex.

niwinz commented 7 years ago

many thanks! I'll fix it asap

niwinz commented 7 years ago

Fixed and released 1.0.6

AdamFrey commented 7 years ago

Thank you!