55 lines
1.7 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
plug BlogWeb.Plugs.EnsureUserId
12
end
13
14
pipeline :api do
15
plug :accepts, ["json"]
16
end
17
18
scope "/", BlogWeb do
19
pipe_through :browser
20
21
live "/", PostLive.Index
22
live "/post/:slug", PostLive
23
live "/faketweets", FakeTweetsLive
24
live "/vim", VimTweetsLive
25
live "/keylogger", KeyloggerLive
26
live "/gay_chaos", RainbowLive, :index
27
live "/mirror", MirrorLive, :index
28
live "/reddit-links", RedditLinksLive, :index
29
live "/cursor-tracker", CursorTrackerLive, :index
30
live "/emoji-skeets", EmojiSkeetsLive, :index
31
live "/allowed-chats", AllowedChatsLive, :index
32
end
33
34
# Other scopes may use custom stacks.
35
# scope "/api", BlogWeb do
36
# pipe_through :api
37
# end
38
39
# Enable LiveDashboard and Swoosh mailbox preview in development
40
if Application.compile_env(:blog, :dev_routes) do
41
# If you want to use the LiveDashboard in production, you should put
42
# it behind authentication and allow only admins to access it.
43
# If your application does not have an admins-only section yet,
44
# you can use Plug.BasicAuth to set up some basic authentication
45
# as long as you are also using SSL (which you should anyway).
46
import Phoenix.LiveDashboard.Router
47
48
scope "/dev" do
49
pipe_through :browser
50
51
live_dashboard "/dashboard", metrics: BlogWeb.Telemetry
52
forward "/mailbox", Plug.Swoosh.MailboxPreview
53
end
54
end
55
end
56