51 lines
1.5 kB
1
defmodule BlogWeb.Router do
2
use BlogWeb, :router
3
4
pipeline :browser do
5
plug :accepts, ["html"]
6
plug :fetch_session
7
plug :fetch_live_flash
8
plug :put_root_layout, html: {BlogWeb.Layouts, :root}
9
plug :protect_from_forgery
10
plug :put_secure_browser_headers
11
end
12
13
pipeline :api do
14
plug :accepts, ["json"]
15
end
16
17
scope "/", BlogWeb do
18
pipe_through :browser
19
20
live "/", PostLive.Index
21
live "/post/:slug", PostLive
22
live "/grid", GridLive, :index
23
live "/muenster", MuensterLive
24
live "/faketweets", FakeTweetsLive
25
live "/vim", VimTweetsLive
26
live "/keylogger", KeyloggerLive
27
live "/rainbow", RainbowLive, :index
28
end
29
30
# Other scopes may use custom stacks.
31
# scope "/api", BlogWeb do
32
# pipe_through :api
33
# end
34
35
# Enable LiveDashboard and Swoosh mailbox preview in development
36
if Application.compile_env(:blog, :dev_routes) do
37
# If you want to use the LiveDashboard in production, you should put
38
# it behind authentication and allow only admins to access it.
39
# If your application does not have an admins-only section yet,
40
# you can use Plug.BasicAuth to set up some basic authentication
41
# as long as you are also using SSL (which you should anyway).
42
import Phoenix.LiveDashboard.Router
43
44
scope "/dev" do
45
pipe_through :browser
46
47
live_dashboard "/dashboard", metrics: BlogWeb.Telemetry
48
forward "/mailbox", Plug.Swoosh.MailboxPreview
49
end
50
end
51
end
52