1defmodule CometWeb.Router do
2 use CometWeb, :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: {CometWeb.Layouts, :root}
9 plug :protect_from_forgery
10 plug :put_secure_browser_headers
11 end
12
13 pipeline :api do
14 plug :accepts, ["json"]
15 end
16
17 scope "/", CometWeb do
18 pipe_through :browser
19
20 get "/", PageController, :home
21 end
22
23 # Other scopes may use custom stacks.
24 # scope "/api", CometWeb do
25 # pipe_through :api
26 # end
27
28 # Enable LiveDashboard and Swoosh mailbox preview in development
29 if Application.compile_env(:comet, :dev_routes) do
30 # If you want to use the LiveDashboard in production, you should put
31 # it behind authentication and allow only admins to access it.
32 # If your application does not have an admins-only section yet,
33 # you can use Plug.BasicAuth to set up some basic authentication
34 # as long as you are also using SSL (which you should anyway).
35 import Phoenix.LiveDashboard.Router
36
37 scope "/dev" do
38 pipe_through :browser
39
40 live_dashboard "/dashboard", metrics: CometWeb.Telemetry
41 forward "/mailbox", Plug.Swoosh.MailboxPreview
42 end
43 end
44end