Where should one “plug” so that the function is called for every action of every controller BUT the controller/action is already known? Is there such a place? After the router but before the actual action.
Neither plugging into the router nor endpoint seems to be able to cut it…
You could place the plug at the top of the controller file, in each controller
It is even possible to do it in a single line in
def controller do
use Phoenix.Controller, namespace: MyAppWeb
alias MyAppWeb.Router.Helpers, as: Routes
Or near the top of the
Isnt the router plugged in the Endpoint?
Yes, sure. Just that’s not what I am looking for. I’d like to have it done once
? Where in the router would one have to put it so that both controller and action is already at play?