All improvements in one commit.

This commit is contained in:
smruthi2187
2018-02-08 13:58:44 -08:00
parent a5cb1d3e3d
commit 4e445bb3cc
10 changed files with 172 additions and 16 deletions
+5
View File
@@ -128,8 +128,13 @@ func (api *API) ApiVersionMismatchHandler(w http.ResponseWriter, r *http.Request
api.respondWithError(w, err)
}
func (api *API) HealthHandler (w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func (api *API) Serve(port int) {
r := mux.NewRouter()
r.HandleFunc("/healthz", api.HealthHandler).Methods("GET")
// Give a useful error message if an older CLI attempts to make a request
r.HandleFunc(`/v1/{rest:[a-zA-Z0-9=\-\/]+}`, api.ApiVersionMismatchHandler)
r.HandleFunc("/", api.HomeHandler)