Phoenix guide, Context: call a plug function in a Router scope

Tks for the explanation.

I ended up with

import MyAppWeb.SessionAuth, only: [authenticate_user: 2] # import plug function
pipe_through [:browser, :authenticate_user]

And if the module MyApp.SessionAuth becomes too big, I will split it into MyApp.Web.Session and MyApp.Web.Auth and use module plugs instead.