Add first version of UI

This commit is contained in:
TwinProduction
2019-09-12 16:15:42 -04:00
parent f1497bec49
commit 88c35e30b4
4 changed files with 137 additions and 24 deletions

View File

@ -12,7 +12,7 @@ func main() {
go watchdog.Monitor()
http.HandleFunc("/api/v1/results", serviceResultsHandler)
http.HandleFunc("/health", healthHandler)
http.HandleFunc("/", indexHandler)
http.Handle("/", http.FileServer(http.Dir("./static")))
log.Println("[main][main] Listening on port 80")
log.Fatal(http.ListenAndServe(":80", nil))
}
@ -23,11 +23,6 @@ func serviceResultsHandler(writer http.ResponseWriter, request *http.Request) {
_, _ = writer.Write(structToJsonBytes(serviceResults))
}
func indexHandler(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusNotImplemented)
_, _ = writer.Write(structToJsonBytes(&core.ServerMessage{Error: true, Message: "Not implemented yet"}))
}
func healthHandler(writer http.ResponseWriter, request *http.Request) {
writer.WriteHeader(http.StatusOK)
_, _ = writer.Write(structToJsonBytes(&core.HealthStatus{Status: "UP"}))