完善了Web管理端
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"Embalming_Girl_Server/admin"
|
||||
"Embalming_Girl_Server/db"
|
||||
"Embalming_Girl_Server/handler"
|
||||
"encoding/json"
|
||||
"log"
|
||||
"net/http"
|
||||
)
|
||||
@@ -33,6 +34,11 @@ func main() {
|
||||
"online_clients": hub.OnlineCount(),
|
||||
}
|
||||
})
|
||||
admin.RegisterUpdateRoutes(mux)
|
||||
mux.HandleFunc("/api/admin/online", func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(hub.OnlineClientsList())
|
||||
})
|
||||
|
||||
addr := ":8080"
|
||||
log.Printf("Server started on %s", addr)
|
||||
|
||||
Reference in New Issue
Block a user