package application import ( "encoding/json" "fmt" "net/http" ) func (app *Application) GetServerInfo(w http.ResponseWriter, r *http.Request) { app.mu.Lock() defer app.mu.Unlock() serverInfo := ServerInfo{ IsInitialized: len(app.users) > 1, } w.Header().Add("Content-Type", "application/json") jsonString, _ := json.Marshal(serverInfo) fmt.Fprintf(w, "%s", string(jsonString)) }