Documentation
¶
Overview ¶
Package dashboard provides a single-page web dashboard for cloudmock, served on the dashboard port and talking to the admin API.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves the cloudmock web dashboard as a Vite-built SPA. When an admin API handler is attached via SetAdminHandler, requests to /api/* are delegated to it, making the dashboard port a single-origin server for both the UI and the admin API (eliminates CORS).
func New ¶
New creates a dashboard Handler. The adminPort parameter is kept for API compatibility but is no longer injected into the HTML (the SPA discovers the admin port at runtime).
func (*Handler) ServeHTTP ¶
func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implements http.Handler. It serves static assets from the embedded dist directory. For any path that does not match a static file, it serves index.html (SPA fallback for client-side routing). Requests to /api/* are forwarded to the admin API handler when one is attached.
func (*Handler) SetAdminHandler ¶
SetAdminHandler attaches an admin API handler so that /api/* requests are served on the same port as the SPA (single-origin, no CORS needed).