Stats handles GET /dashboard/stats.
(w http.ResponseWriter, r *http.Request)
| 29 | |
| 30 | // Stats handles GET /dashboard/stats. |
| 31 | func (h *DashboardHandler) Stats(w http.ResponseWriter, r *http.Request) { |
| 32 | stats, err := h.dashboard.GetStats(r.Context()) |
| 33 | if err != nil { |
| 34 | Error(w, http.StatusInternalServerError, "Failed to load dashboard stats") |
| 35 | return |
| 36 | } |
| 37 | JSON(w, http.StatusOK, stats) |
| 38 | } |
| 39 | |
| 40 | // Hosts handles GET /dashboard/hosts. |
| 41 | func (h *DashboardHandler) Hosts(w http.ResponseWriter, r *http.Request) { |