Skip to content

Commit

Permalink
adds /ping and /version http endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
christianparpart committed Mar 23, 2016
1 parent 38b0a86 commit 8d7f845
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ type mmsdService struct {

func (mmsd *mmsdService) setupHttpService() {
router := mux.NewRouter()
router.HandleFunc("/ping", mmsd.v0Ping)
router.HandleFunc("/version", mmsd.v0Version)

v1 := router.PathPrefix("/v1").Subrouter()
v1.HandleFunc("/apps", mmsd.v1Apps).Methods("GET")
v1.HandleFunc("/instances{app_id:/.*}", mmsd.v1Instances).Methods("GET")
Expand All @@ -89,6 +92,14 @@ func (mmsd *mmsdService) setupHttpService() {
go http.ListenAndServe(serviceAddr, router)
}

func (mmsd *mmsdService) v0Ping(w http.ResponseWriter, r *http.Request) {
fmt.Fprint(w, "pong\n")
}

func (mmsd *mmsdService) v0Version(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "mmsd %v\n", appVersion)
}

func (mmsd *mmsdService) v1Apps(w http.ResponseWriter, r *http.Request) {
m, err := marathon.NewService(mmsd.MarathonIP, mmsd.MarathonPort)

Expand Down

0 comments on commit 8d7f845

Please sign in to comment.