diff --git a/http/http.go b/http/http.go index 71b42cf..aea253e 100644 --- a/http/http.go +++ b/http/http.go @@ -68,6 +68,7 @@ func newRouter(s *Server) *httprouter.Router { r.PUT("/torrents/:infohash", makeHandler(s.putTorrent)) r.DELETE("/torrents/:infohash", makeHandler(s.delTorrent)) r.GET("/check", makeHandler(s.check)) + r.GET("/stats", makeHandler(s.stats)) return r } diff --git a/http/routes.go b/http/routes.go index 8fc6797..5256c63 100644 --- a/http/routes.go +++ b/http/routes.go @@ -20,6 +20,15 @@ import ( const jsonContentType = "application/json; charset=UTF-8" func (s *Server) check(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) { + _, err := w.Write([]byte("An easter egg goes here.")) + if err != nil { + return http.StatusInternalServerError, err + } + + return http.StatusOK, nil +} + +func (s *Server) stats(w http.ResponseWriter, r *http.Request, p httprouter.Params) (int, error) { w.Header().Set("Content-Type", jsonContentType) e := json.NewEncoder(w)