router.ex 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. defmodule VaccinsWeb.Router do
  2. use VaccinsWeb, :router
  3. import VaccinsWeb.Plugs
  4. pipeline :browser do
  5. plug :accepts, ["html"]
  6. plug :fetch_session
  7. plug :fetch_live_flash
  8. plug :put_root_layout, {VaccinsWeb.LayoutView, :root}
  9. plug :protect_from_forgery
  10. plug :put_secure_browser_headers
  11. plug :set_local_conn
  12. end
  13. pipeline :api do
  14. plug :accepts, ["json"]
  15. end
  16. scope "/", VaccinsWeb do
  17. pipe_through :browser
  18. live "/", IndexLive, :index
  19. end
  20. # Other scopes may use custom stacks.
  21. # scope "/api", VaccinsWeb do
  22. # pipe_through :api
  23. # end
  24. # Enables LiveDashboard only for development
  25. #
  26. # If you want to use the LiveDashboard in production, you should put
  27. # it behind authentication and allow only admins to access it.
  28. # If your application does not have an admins-only section yet,
  29. # you can use Plug.BasicAuth to set up some basic authentication
  30. # as long as you are also using SSL (which you should anyway).
  31. if Mix.env() in [:dev, :test] do
  32. import Phoenix.LiveDashboard.Router
  33. scope "/" do
  34. pipe_through :browser
  35. live_dashboard "/dashboard", metrics: VaccinsWeb.Telemetry
  36. end
  37. end
  38. end