32 lines
743 B
Go
32 lines
743 B
Go
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", htop.UpdateHTop)
|
|
http.HandleFunc("/", handlers.UpdateMainPage)
|
|
http.HandleFunc("/taskmanager/kill", handlers.KillHandler)
|
|
http.HandleFunc("/taskmanager/usage", handlers.UsageHandler)
|
|
|
|
log.Printf("Listening on http://localhost:%d/taskmanager/htop\n", *port)
|
|
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", *port), nil))
|
|
}
|