From cbb45c3fd7e09925833e3f72fe023d418f4b9639 Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Fri, 9 Jan 2015 11:10:43 -0900 Subject: [PATCH] Placeholder for health check endpoint --- api/auth.go | 4 ---- api/handler.go | 6 ++++++ router/api.go | 3 +++ router/routes.go | 2 ++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/api/auth.go b/api/auth.go index bdcb2e0..43b43a1 100644 --- a/api/auth.go +++ b/api/auth.go @@ -115,7 +115,3 @@ func (h authHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { writeJSON(w, Error{hErr}) } } - -func restrictedHandler(w http.ResponseWriter, r *http.Request) error { - return writeJSON(w, Message{"great success"}) -} diff --git a/api/handler.go b/api/handler.go index 3a920d4..e25e097 100644 --- a/api/handler.go +++ b/api/handler.go @@ -74,6 +74,8 @@ func Handler() *mux.Router { m.Get(router.SubrouterListStrains).Handler(authHandler(serveSubrouterStrainsList)) m.Get(router.SubrouterListMeasurements).Handler(authHandler(serveSubrouterMeasurementsList)) + m.Get(router.Health).Handler(handler(healthHandler)) + return m } @@ -86,3 +88,7 @@ func (h handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { writeJSON(w, Error{err}) } } + +func healthHandler(w http.ResponseWriter, r *http.Request) error { + return writeJSON(w, Message{"great success"}) +} diff --git a/router/api.go b/router/api.go index 127e23a..739873b 100644 --- a/router/api.go +++ b/router/api.go @@ -73,5 +73,8 @@ func API() *mux.Router { s.Path("/strains").Methods("GET").Name(SubrouterListStrains) s.Path("/measurements").Methods("GET").Name(SubrouterListMeasurements) + // Misc + m.Path("/health").Methods("GET").Name(Health) + return m } diff --git a/router/routes.go b/router/routes.go index 33f7eed..0c38838 100644 --- a/router/routes.go +++ b/router/routes.go @@ -57,4 +57,6 @@ const ( SubrouterListSpecies = "subrouter_species:list" SubrouterListStrains = "subrouter_strains:list" SubrouterListMeasurements = "subrouter_measurements:list" + + Health = "health:get" )