Add minimal topology web UI and serve static files.

Provide browser-based topology viewer at root path and update technical spec checkboxes for completed UI milestone.

Made-with: Cursor
This commit is contained in:
Andrey Lutsenko
2026-04-09 22:07:15 +10:00
parent df32d43ac5
commit f1545b2afd
4 changed files with 140 additions and 3 deletions
+6 -1
View File
@@ -54,6 +54,9 @@ func NewHandler(store scans.Store, run *scans.Runner) *Handler {
func (h *Handler) Routes() http.Handler {
mux := http.NewServeMux()
webFS := http.FileServer(http.Dir("web"))
mux.Handle("GET /", webFS)
mux.Handle("GET /web/", http.StripPrefix("/web/", webFS))
mux.HandleFunc("GET /health", h.health)
mux.HandleFunc("POST /api/scans", h.createScan)
mux.HandleFunc("GET /api/scans", h.listScans)
@@ -411,7 +414,9 @@ func (h *Handler) getScanTopology(w http.ResponseWriter, r *http.Request) {
func withJSON(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
if strings.HasPrefix(r.URL.Path, "/api/") || r.URL.Path == "/health" {
w.Header().Set("Content-Type", "application/json; charset=utf-8")
}
next.ServeHTTP(w, r)
})
}