dashboard

package
v1.10.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 7 Imported by: 0

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

func New(adminPort int) *Handler

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

func (h *Handler) SetAdminHandler(handler http.Handler)

SetAdminHandler attaches an admin API handler so that /api/* requests are served on the same port as the SPA (single-origin, no CORS needed).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL