Hi all
I have following code snippet for scope definition:
scope “/”, Rumbl do`
My question is, what is the second parameter for a type a module? And for what is good for?
Thanks
Hi all
I have following code snippet for scope definition:
scope “/”, Rumbl do`
My question is, what is the second parameter for a type a module? And for what is good for?
Thanks
This is the relevant section of the guide: http://www.phoenixframework.org/docs/routing#section-scoped-routes
I haven’t read it well myself yet, but my main use case for it is to not have to fully qualify the controllers references within the scope. I haven’t verified this code works exactly as is, each scope block below should be equivalent.
scope "/" do
pipe_through [:browser]
get "/api/user/", Rumbl.Api.UserController, :show
end
scope "/", Rumbl do
pipe_through [:browser]
get "/api/user/", Api.UserController, :show
end
scope "/", Rumbl.Api do
pipe_through [:browser]
get "/api/user/", UserController, :show
end
Thanks so much.