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