From ff1f10801f8852f9ef9f0cecf4cd7ada3ad06c12 Mon Sep 17 00:00:00 2001 From: Baitinq Date: Thu, 30 May 2024 19:23:04 +0200 Subject: rest-api: return 404 for all other routes except / --- src/rest-api/cmd/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/rest-api/cmd/main.go b/src/rest-api/cmd/main.go index ff91856..a493913 100644 --- a/src/rest-api/cmd/main.go +++ b/src/rest-api/cmd/main.go @@ -61,6 +61,11 @@ func main() { mux := http.NewServeMux() mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { + if r.URL.Path != "/" { + http.NotFound(w, r) + return + } + fmt.Fprint(w, "Hello folks!") }) mux.Handle("/api/v1/file/", handler) -- cgit 1.4.1