What I'd like to be able to do is something like this:
get "/:id", SomeController, :show where Regex.match?(~r/^\d{5}$/, id)
get "/:id", OtherController, :show where Regex.match?(~r/^A\d{4}$/, id)
That is - where a named component of the URL matches a regular expression, that route is used. In Rails, my regular framework, this would be expressed as:
get '/:id', to: 'some#show', id: /\d{5}/
get '/:id', to: 'other#show', id: /A\d{4}/
But I can't find a Phoenix (well, Plug) equivalent, and my Elixir's still a little weak for me to know where to get started writing my own.
Any suggestions? Thanks!
--
You received this message because you are subscribed to the Google Groups "phoenix-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to phoenix-talk...@googlegroups.com.
To post to this group, send email to phoeni...@googlegroups.com.
Visit this group at https://groups.google.com/group/phoenix-talk.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/f1453e15-178e-4e3a-acb4-3c137f00c5b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/538e967c-7445-429a-8b53-66aadcb935bc%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/phoenix-talk/788bbd88-e5ef-499d-bdaf-0c6ce5e69c19%40googlegroups.com.