To me, there seems to be no difference, but I would like to confirm if I’m correct. If I am, please let me know if there are any considerations I should be aware of in your opinion. Could you please take a look? Thank you.
The first group contains a Plugs pipeline inside the live_session for the admin, while the second group has the Plugs pipeline outside the live_session but scoped to it. Here are the two code examples for reference:
First group:
live_session :admin, on_mount: MyAppWeb.AdminLiveAuth do
scope "/" do
# Plugs pipeline inside live_session
pipe_through [MyAppWeb.AdminPlugAuth]
# Live routes
live "/admin", AdminDashboardLive, :index
live "/admin/posts", AdminPostLive, :index
end
end
Second group:
scope "/" do
# Plugs pipeline outside live_session but scoped to it
pipe_through [MyAppWeb.AdminPlugAuth]
live_session :admin, on_mount: MyAppWeb.AdminLiveAuth do
# Live routes
live "/admin", AdminDashboardLive, :index
live "/admin/posts", AdminPostLive, :index
end
end