diff options
Diffstat (limited to 'pkg/web/server.go')
| -rw-r--r-- | pkg/web/server.go | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/pkg/web/server.go b/pkg/web/server.go deleted file mode 100644 index cccb4e1..0000000 --- a/pkg/web/server.go +++ /dev/null @@ -1,28 +0,0 @@ -package web - -import ( - "net/http" - - "gitlab.com/mokhax/sparkled/app/controllers/health" - "gitlab.com/mokhax/sparkled/app/controllers/sparkles" - "gitlab.com/mokhax/sparkled/pkg/db" -) - -type Server struct { - mux *http.ServeMux -} - -func New(storage db.Repository) *Server { - mux := http.NewServeMux() - c := sparkles.New(storage) - mux.HandleFunc("GET /sparkles", c.Index) - mux.HandleFunc("POST /sparkles", c.Create) - mux.HandleFunc("GET /health", health.New().Index) - mux.Handle("GET /", http.FileServer(http.Dir("public"))) - - return &Server{mux: mux} -} - -func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) { - s.mux.ServeHTTP(w, r) -} |
