summaryrefslogtreecommitdiff
path: root/pkg/web/server.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-12 18:11:05 -0600
committermo khan <mo@mokhan.ca>2025-04-12 18:11:05 -0600
commit0bef608297d7def2a18d054e7230fe0e0a3710a7 (patch)
tree93a8ec34baa695705832ace22266e1f13cb9e64e /pkg/web/server.go
parent54715831a2d307390c05214b6ae8bc721ade6680 (diff)
refactor: extract mountable interface to allow controllers to mount themselves into the muxHEADmain
Diffstat (limited to 'pkg/web/server.go')
-rw-r--r--pkg/web/server.go28
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)
-}