-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrouter.ex
35 lines (29 loc) · 909 Bytes
/
router.ex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
defmodule AppWeb.Router do
use AppWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {AppWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
end
#pipeline :api do
# plug :accepts, ["json"]
#end
pipeline :authOptional, do: plug(AuthPlugOptional)
scope "/", AppWeb do
pipe_through [:browser, :authOptional]
get "/", ItemController, :index
get "/login", AuthController, :login
get "/logout", AuthController, :logout
get "/items/toggle/:id", ItemController, :toggle
get "/items/clear", ItemController, :clear_completed
get "/items/filter/:filter", ItemController, :index
resources "/items", ItemController, except: [:show]
end
# Other scopes may use custom stacks.
# scope "/api", AppWeb do
# pipe_through :api
# end
end