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