I never fully understood how Phoenix is able to route urls with params like
"users/1" to the correct Controller, Action. From what I understand Phoenix pattern matches the path on incoming requests. For example, its easy to see how
"/users" will match this get macro.
get "/users", UserController, :index
But how does Phoenix route
"/users/1" to this.
get "/users/:id", UserController, :show
How does Phoenix match
I know it can’t be traditional pattern matching otherwise you’d get a
no function clause matching error.
There must be some kind of macro magic happening behind the scenes that I don’t understand.