Basic UI working state. Still needs clean and Assetfs to keep all dependencies in the application

This commit is contained in:
Nicholas Thompson
2019-02-26 23:25:37 +02:00
committed by ncthompson
parent f189ff0442
commit 8267e71f18
11 changed files with 773 additions and 58 deletions

24
cmd/guimock/main.go Normal file
View File

@@ -0,0 +1,24 @@
package main
import (
"flag"
"log"
"net/http"
"github.com/hpdvanwyk/invertergui/webgui"
"github.com/prometheus/client_golang/prometheus/promhttp"
)
func main() {
addr := flag.String("addr", ":8080", "TCP address to listen on.")
mk2 := NewMk2Mock()
gui := webgui.NewWebGui(mk2)
http.Handle("/ws", http.HandlerFunc(gui.ServeHub))
http.Handle("/", gui)
http.Handle("/js/controller.js", http.HandlerFunc(gui.ServeJS))
http.Handle("/munin", http.HandlerFunc(gui.ServeMuninHTTP))
http.Handle("/muninconfig", http.HandlerFunc(gui.ServeMuninConfigHTTP))
http.Handle("/metrics", promhttp.Handler())
log.Fatal(http.ListenAndServe(*addr, nil))
}