Phoenix Scoping

Is it possible to use the phoenix scope macro and drop some of the routes to the “root” scope namespace module?

So in the following example:

scope("/v1", ScopeNamespaceModule) do
  pipe_through(:api)
  get("/", <what goes here?>, :index)
  get("/foo", Foo, :index)
end

going to “/” would call ScopeNamespaceModule.call(conn, :index)
and going to “/foo” would call ScopeNamespaceModule.Foo.call(conn, :index)

?

alias ScopeNamespaceModule.Foo? :stuck_out_tongue_winking_eye:

jk, I don’t know

UPD: ignore me :man_facepalming:t2:

scope path: "/v1" do
  pipe_through(:api)
  get("/", ScopeNamespaceModule, :index)

  scope alias: ScopeNamespaceModule do
    get("/foo", Foo, :index)
  end
end
5 Likes

Perfect, thanks!