我在处理我自己的项目时正在阅读凤凰书,我收到了这个错误:
== Compilation error in file web/router.ex ==
** (CompileError) web/router.ex:2: module Phoenix.Auth is not loaded and
could not be found
expanding macro: ComicApp.Web.__using__/1
web/router.ex:2: ComicApp.Router (module)
(elixir) expanding macro: Kernel.use/2
web/router.ex:2: ComicApp.Router (module)
(elixir) lib/kernel/parallel_compiler.ex:198: anonymous fn/4 in
Kernel.ParallelCompiler.spawn_workers/6
转到这些页面的代码如下:
defmodule ComicApp.Router do
use ComicApp.Web, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_flash
plug :protect_from_forgery
plug :put_secure_browser_headers
plug ComicApp.Auth, repo: ComicApp.Repo
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", ComicApp do
pipe_through :browser # Use the default browser stack
get "/", PageController, :index
resources "/users", UserController, only: [:index, :show, :new,
:create]
resources "/sessions", SessionController, only: [:new, :create,
:delete]
end
scope "/manage", ComicApp do
pipe_through [:browser, :authenticate_user]
resources "/comics", ComicController
end
end
这是我的GitHub文件:https://github.com/cggarcia171/ComicBookLibrary