initial commit of api

This commit is contained in:
David
2020-08-06 14:15:14 -04:00
parent 5db9d387df
commit a651b9cd73
9 changed files with 420 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
package http
import (
"net/http"
"github.com/go-chi/chi"
"github.com/go-chi/chi/middleware"
)
func (s *Server) BuildRoutes() http.Handler {
r := chi.NewRouter()
r.Use(middleware.Logger)
r.Post("/limit", s.setLimit)
r.Route("/data", func(r chi.Router) {
r.Use(s.rateLimiter)
r.Use(s.faulty)
r.Get("/", s.getData)
})
return r
}