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:
@@ -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)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user