Skip to content

Commit 57056fd

Browse files
committed
minor improvements to server code
1 parent a71ca63 commit 57056fd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

platform/website/server/server.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,17 @@ var requestsServed = promauto.NewCounter(prometheus.CounterOpts{
1717
})
1818

1919
func page(w http.ResponseWriter, r *http.Request) {
20-
fmt.Fprintf(w, "Welcome to the homeworld self-hosting website.")
20+
if r.URL.Path != "/" {
21+
http.NotFound(w, r)
22+
return
23+
}
24+
fmt.Fprintln(w, "Welcome to the homeworld self-hosting website.")
2125
requestsServed.Inc()
2226
}
2327

2428
func main() {
2529
http.HandleFunc("/", page)
2630
http.Handle("/metrics", promhttp.Handler())
31+
log.Println("Listening on :8080")
2732
log.Fatal(http.ListenAndServe(":8080", nil))
2833
}

0 commit comments

Comments
 (0)