Show Workers on index
This commit is contained in:
parent
d0f220fd0a
commit
ab71e2b90c
1 changed files with 11 additions and 1 deletions
|
@ -1,9 +1,19 @@
|
|||
package server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
func handleIndex(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write([]byte("Alive"))
|
||||
data := "Connections:\n"
|
||||
func() {
|
||||
WorkersMutex.Lock()
|
||||
defer WorkersMutex.Unlock()
|
||||
for i := range Workers {
|
||||
data = data + fmt.Sprintf("ID: %v, Name: %v, Address: %v Connected %v\n", i, Workers[i].Name, Workers[i].Address, Workers[i].Connected)
|
||||
}
|
||||
}()
|
||||
|
||||
w.Write([]byte("Morffix\n" + data))
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue