Files
something-erlang/lib/something_erlang_web/router.ex

45 lines
1.3 KiB
Elixir
Raw Normal View History

2022-05-23 15:57:15 +02:00
defmodule SomethingErlangWeb.Router do
use SomethingErlangWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
2024-06-02 13:31:19 +02:00
plug :put_root_layout, html: {SomethingErlangWeb.Layouts, :root}
2022-05-23 15:57:15 +02:00
plug :protect_from_forgery
plug :put_secure_browser_headers
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", SomethingErlangWeb do
2024-06-02 13:31:19 +02:00
pipe_through :browser
2022-05-23 15:57:15 +02:00
2023-01-18 16:13:51 +01:00
get "/", PageController, :home
2022-05-23 15:57:15 +02:00
end
2024-06-02 13:31:19 +02:00
# Other scopes may use custom stacks.
# scope "/api", SomethingErlangWeb do
# pipe_through :api
# end
2022-05-23 15:57:15 +02:00
2024-03-29 15:54:42 +01:00
# Enable LiveDashboard and Swoosh mailbox preview in development
if Application.compile_env(:something_erlang, :dev_routes) do
# 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).
import Phoenix.LiveDashboard.Router
2022-05-23 15:57:15 +02:00
2024-03-29 15:54:42 +01:00
scope "/dev" do
pipe_through :browser
2023-01-18 16:13:51 +01:00
2024-06-02 13:31:19 +02:00
live_dashboard "/dashboard", metrics: SomethingErlangWeb.Telemetry
2024-03-29 15:54:42 +01:00
forward "/mailbox", Plug.Swoosh.MailboxPreview
2023-01-18 16:13:51 +01:00
end
2022-05-23 15:57:15 +02:00
end
end