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