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