0
votes

After editing my router config I stumbled across a weird error looking like that "function AnyController.init/1 is undefined".

  scope "/" do
    pipe_through([:require_login])
    resources("/users", UserController,
      only: [:index, :show, :create, :update, :delete])
  end

  post("/auth/login", AuthController, :login)
  post("/auth/refresh-token", AuthController, :refresh_token)
1

1 Answers

0
votes

I figured out why the error appeared. I removed the second argument of the scope/4 function which takes the namespace of your controller as parameter. I was able to fix the error doing the following :

scope "/", MyAppWeb do
  pipe_through([:require_login])
  resources("/users", UserController, only: [:index, :show, :create, :update, :delete])
end

scope "/", MyAppWeb do
  post("/auth/login", AuthController, :login)
  post("/auth/refresh-token", AuthController, :refresh_token)
end