Spaces:
Sleeping
Sleeping
File size: 867 Bytes
b6f0124 0fea377 b6f0124 0fea377 b6f0124 0fea377 b6f0124 |
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 |
defmodule ChaiWeb.Router do
use ChaiWeb, :router
pipeline :browser do
plug :accepts, ["html"]
plug :fetch_session
plug :fetch_live_flash
plug :put_root_layout, {ChaiWeb.Layouts, :root}
plug :protect_from_forgery
plug :put_secure_browser_headers
plug :allow_within_iframe
end
pipeline :api do
plug :accepts, ["json"]
end
scope "/", ChaiWeb do
pipe_through :browser
live "/", ChatLive, :page
end
# Enable LiveDashboard in development
if Application.compile_env(:chai, :dev_routes) do
import Phoenix.LiveDashboard.Router
scope "/dev" do
pipe_through :browser
live_dashboard "/dashboard", metrics: ChaiWeb.Telemetry
end
end
# Allow the app to run inside iframe (on HF Spaces)
defp allow_within_iframe(conn, _opts) do
delete_resp_header(conn, "x-frame-options")
end
end
|