add configuration

This commit is contained in:
Pijus Kamandulis
2025-05-27 21:56:19 +03:00
parent d836830f45
commit 1cc12afa16
6 changed files with 79 additions and 24 deletions

View File

@@ -5,16 +5,10 @@ import (
"net/http"
"pool-stats/stats"
"github.com/ostafen/clover/v2"
)
type Handlers struct {
DB *clover.DB
}
func (h Handlers) IndexHandler(w http.ResponseWriter, r *http.Request) {
shareStats, err := stats.GetStats(h.DB)
func (ws *WebServer) IndexHandler(w http.ResponseWriter, r *http.Request) {
shareStats, err := stats.GetStats(ws.db)
if err != nil {
http.Error(w, "Failed to load stats", 500)
return