Is there any difference between these two groups of Phoenix live routes definitions?

There is no difference.

Scopes simply augment any route (or nested scope) in their body. So does live_session. In the end all that’s left is a list of Route structs.

Technically the order does not matter.

If you want to confirm you can use Routex and write a simple extension module with…

defmodule InspectExtension do
  transform(routes, _backend, _env) do
    IO.inspect(routes)
  end
end

Both variants should render the exact same list of routes.

(from mobile, untested, if you do feel free to open a PR as it’s a nice addition)

3 Likes