defmodule ShootingEventPhxWeb.Router do use ShootingEventPhxWeb, :router pipeline :api_json do plug :accepts, ["json"] end pipeline :frontend do end pipeline :admin_api do plug ShootingEventPhxWeb.Plugs.AdminOnly end scope "/api", ShootingEventPhxWeb do get "/events", EventsController, :stream end scope "/api", ShootingEventPhxWeb do pipe_through :api_json get "/health", ApiController, :health get "/state", ApiController, :state post "/admin/login", ApiController, :admin_login scope "/admin" do pipe_through :admin_api post "/logout", ApiController, :admin_logout get "/state", ApiController, :admin_state put "/settings", ApiController, :update_settings post "/players", ApiController, :create_player post "/players/auto-group", ApiController, :auto_group_players put "/players/:id", ApiController, :update_player delete "/players/:id", ApiController, :delete_player put "/scores/:stage/:id", ApiController, :update_score put "/scores/:stage/:id/proof", ApiController, :update_score_proof delete "/scores/:stage/:id/proof", ApiController, :delete_score_proof post "/scores/:stage/:id/advice", ApiController, :score_advice post "/scores/:stage/reset", ApiController, :reset_stage end end scope "/", ShootingEventPhxWeb do pipe_through :frontend match :*, "/*path", FrontendController, :serve end end