summaryrefslogtreecommitdiff
path: root/pkg/web/server.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-04-11 15:42:07 -0600
committermo khan <mo@mokhan.ca>2025-04-11 15:42:07 -0600
commit49e61799c837cf49687d9a15a2fb0b04ca74d47c (patch)
treeb2b8df8864041efa936b7bb0c56e8ddc2aba473b /pkg/web/server.go
parent2c018238c7f4aba8db9cbbe3eadb91b85c50629e (diff)
refactor: extract test helpers
Diffstat (limited to 'pkg/web/server.go')
-rw-r--r--pkg/web/server.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/pkg/web/server.go b/pkg/web/server.go
index c87873c..cde347c 100644
--- a/pkg/web/server.go
+++ b/pkg/web/server.go
@@ -21,14 +21,15 @@ func NewServer(storage db.Repository) *Server {
}
func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
- switch r.URL.String() {
- case "/health":
- w.WriteHeader(http.StatusOK)
- case "/sparkles.json":
- switch r.Method {
- case "GET":
+ switch r.Method {
+ case "GET":
+ switch r.URL.String() {
+ case "/health":
+ w.WriteHeader(http.StatusOK)
+ case "/sparkles":
serde.ToHTTP(w, r, s.db.All())
}
+ break
default:
s.fileserver.ServeHTTP(w, r)
break