Files
oslstats/internal/handlers/index.go
2026-02-02 19:12:14 +11:00

23 lines
473 B
Go

package handlers
import (
"net/http"
"git.haelnorr.com/h/oslstats/internal/view/page"
"git.haelnorr.com/h/golib/hws"
)
// Index handles responses to the / path. Also serves a 404 Page for paths that
// don't have explicit handlers
func Index(s *hws.Server) http.Handler {
return http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
throwNotFound(s, w, r, r.URL.Path)
}
renderSafely(page.Index(), s, r, w)
},
)
}