50 lines
1.4 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
end
28
29
# Other scopes may use custom stacks.
30
# scope "/api", BlogWeb do
31
# pipe_through :api
32
# end
33
34
# Enable LiveDashboard and Swoosh mailbox preview in development
35
if Application.compile_env(:blog, :dev_routes) do
36
# If you want to use the LiveDashboard in production, you should put
37
# it behind authentication and allow only admins to access it.
38
# If your application does not have an admins-only section yet,
39
# you can use Plug.BasicAuth to set up some basic authentication
40
# as long as you are also using SSL (which you should anyway).
41
import Phoenix.LiveDashboard.Router
42
43
scope "/dev" do
44
pipe_through :browser
45
46
live_dashboard "/dashboard", metrics: BlogWeb.Telemetry
47
forward "/mailbox", Plug.Swoosh.MailboxPreview
48
end
49
end
50
end
51