added visualisation
This commit is contained in:
@@ -36,6 +36,7 @@ func startServer() {
|
||||
port := "8001"
|
||||
r := mux.NewRouter()
|
||||
r.HandleFunc("/", showCharts).Methods("GET")
|
||||
r.HandleFunc("/data/", sendData).Methods("GET")
|
||||
r.HandleFunc("/data/{count}", sendData).Methods("GET")
|
||||
r.HandleFunc("/", saveSnapshot).Methods("POST")
|
||||
r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir("static/"))))
|
||||
@@ -49,9 +50,8 @@ func showCharts(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func sendData(w http.ResponseWriter, r *http.Request) {
|
||||
vars := mux.Vars(r)
|
||||
var count int64 = 50
|
||||
if vars["count"] != "" {
|
||||
if vars := mux.Vars(r); vars["count"] != "" {
|
||||
newCount, err := strconv.ParseInt(vars["count"], 10, 0)
|
||||
if err != nil {
|
||||
sendInternalError(errors.New("bad snapshot count request"), w, r)
|
||||
|
||||
Reference in New Issue
Block a user