first running version
Some checks failed
Build Process Supervisor / build (push) Failing after 1s

This commit is contained in:
Adrian Zürcher
2025-08-05 12:01:59 +02:00
parent 5712929f23
commit b9efeb670d
12 changed files with 365 additions and 92 deletions

19
main.go
View File

@@ -1,18 +1,31 @@
package main
import (
"flag"
"fmt"
"log"
"net/http"
"processSupervisor/handlers"
)
func main() {
port := flag.Uint("port", 9400, "listenig port")
flag.Parse()
htop, err := handlers.NewHTopHandler()
if err != nil {
panic(err)
}
fs := http.FileServer(http.Dir("static"))
http.Handle("/static/", http.StripPrefix("/static/", fs))
http.HandleFunc("/taskmanager/htop", handlers.HtopHandler)
http.HandleFunc("/taskmanager/htop", htop.UpdateHTop)
http.HandleFunc("/", handlers.UpdateMainPage)
http.HandleFunc("/taskmanager/kill", handlers.KillHandler)
http.HandleFunc("/taskmanager/usage", handlers.UsageHandler)
log.Println("Listening on http://localhost:8080/taskmanager/htop")
log.Fatal(http.ListenAndServe(":8080", nil))
log.Printf("Listening on http://localhost:%d/taskmanager/htop\n", *port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
}