mirror of https://github.com/statping/statping
route to api - travis
parent
c9e90c1534
commit
d29d134372
|
@ -40,8 +40,6 @@ before_deploy:
|
||||||
|
|
||||||
after_deploy:
|
after_deploy:
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make publish-homebrew; fi
|
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make publish-homebrew; fi
|
||||||
- snapcraft login --with "$SNAP_TOKEN"
|
|
||||||
- if [[ "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" = "false" ]]; then make snapcraft; fi
|
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
- provider: releases
|
- provider: releases
|
||||||
|
|
|
@ -68,6 +68,7 @@ func sendErrorJson(err error, w http.ResponseWriter, r *http.Request) {
|
||||||
Status: "error",
|
Status: "error",
|
||||||
Error: err.Error(),
|
Error: err.Error(),
|
||||||
}
|
}
|
||||||
|
r.Body.Close()
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(output)
|
json.NewEncoder(w).Encode(output)
|
||||||
}
|
}
|
||||||
|
@ -117,6 +118,7 @@ func sendJsonAction(obj interface{}, method string, w http.ResponseWriter, r *ht
|
||||||
Output: obj,
|
Output: obj,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
r.Body.Close()
|
||||||
w.Header().Set("Content-Type", "application/json")
|
w.Header().Set("Content-Type", "application/json")
|
||||||
json.NewEncoder(w).Encode(output)
|
json.NewEncoder(w).Encode(output)
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,6 @@ func Router() *mux.Router {
|
||||||
|
|
||||||
// SERVICE Routes
|
// SERVICE Routes
|
||||||
r.Handle("/services", http.HandlerFunc(servicesHandler)).Methods("GET")
|
r.Handle("/services", http.HandlerFunc(servicesHandler)).Methods("GET")
|
||||||
r.Handle("/services/reorder", http.HandlerFunc(reorderServiceHandler)).Methods("POST")
|
|
||||||
r.Handle("/service/{id}", http.HandlerFunc(servicesViewHandler)).Methods("GET")
|
r.Handle("/service/{id}", http.HandlerFunc(servicesViewHandler)).Methods("GET")
|
||||||
r.Handle("/service/{id}/edit", http.HandlerFunc(servicesViewHandler))
|
r.Handle("/service/{id}/edit", http.HandlerFunc(servicesViewHandler))
|
||||||
r.Handle("/service/{id}/delete_failures", http.HandlerFunc(servicesDeleteFailuresHandler)).Methods("GET")
|
r.Handle("/service/{id}/delete_failures", http.HandlerFunc(servicesDeleteFailuresHandler)).Methods("GET")
|
||||||
|
@ -94,6 +93,7 @@ func Router() *mux.Router {
|
||||||
r.Handle("/api/services", http.HandlerFunc(apiAllServicesHandler)).Methods("GET")
|
r.Handle("/api/services", http.HandlerFunc(apiAllServicesHandler)).Methods("GET")
|
||||||
r.Handle("/api/services", http.HandlerFunc(apiCreateServiceHandler)).Methods("POST")
|
r.Handle("/api/services", http.HandlerFunc(apiCreateServiceHandler)).Methods("POST")
|
||||||
r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceHandler)).Methods("GET")
|
r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceHandler)).Methods("GET")
|
||||||
|
r.Handle("/api/services/reorder", http.HandlerFunc(reorderServiceHandler)).Methods("POST")
|
||||||
r.Handle("/api/services/{id}/data", cached("120s", "application/json", http.HandlerFunc(apiServiceDataHandler))).Methods("GET")
|
r.Handle("/api/services/{id}/data", cached("120s", "application/json", http.HandlerFunc(apiServiceDataHandler))).Methods("GET")
|
||||||
r.Handle("/api/services/{id}/ping", http.HandlerFunc(apiServicePingDataHandler)).Methods("GET")
|
r.Handle("/api/services/{id}/ping", http.HandlerFunc(apiServicePingDataHandler)).Methods("GET")
|
||||||
r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceUpdateHandler)).Methods("POST")
|
r.Handle("/api/services/{id}", http.HandlerFunc(apiServiceUpdateHandler)).Methods("POST")
|
||||||
|
|
|
@ -61,14 +61,12 @@
|
||||||
newOrder.push(o);
|
newOrder.push(o);
|
||||||
});
|
});
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/services/reorder",
|
url: "/api/services/reorder",
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: JSON.stringify(newOrder),
|
data: JSON.stringify(newOrder),
|
||||||
contentType: "application/json",
|
contentType: "application/json",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function(data) {
|
success: function(data) { }
|
||||||
console.log(data)
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue