~afontaine/home unlisted

ref: f3beb1218e86a2a61489737177c64308174b0201 home/apps/home_web/lib/home_web/router.ex -rw-r--r-- 1.3 KiB
f3beb121Andrew Fontaine Fix typo for Discussion Email 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
defmodule HomeWeb.Router do
  use HomeWeb, :router

  pipeline :browser do
    plug :accepts, ["html"]
    plug :fetch_session
    plug :fetch_flash
    plug :protect_from_forgery
    plug :put_secure_browser_headers
  end

  pipeline :api do
    plug :accepts, ["json"]
  end

  scope "/", HomeWeb do
    pipe_through :api

    get "/.well-known/:path", WellKnownController, :index
  end

  get "/feed", HomeWeb.FeedController, :index

  scope "/", HomeWeb do
    pipe_through :browser

    get "/", PageController, :index

    resources "/blog", PostController, only: [:index, :show], param: "slug"
  end

  # Other scopes may use custom stacks.
  scope "/api", HomeWeb do
    pipe_through :api

    scope "/post" do
      post "/receive", ReceiveController, :receive
    end
  end

  # Enables LiveDashboard only for development
  #
  # If you want to use the LiveDashboard in production, you should put
  # it behind authentication and allow only admins to access it.
  # If your application does not have an admins-only section yet,
  # you can use Plug.BasicAuth to set up some basic authentication
  # as long as you are also using SSL (which you should anyway).
  if Mix.env() in [:dev, :test] do
    import Phoenix.LiveDashboard.Router

    scope "/" do
      pipe_through :browser
      live_dashboard "/dashboard", metrics: HomeWeb.Telemetry
    end
  end
end