Files
oslstats/internal/handlers/index.go
2026-01-23 19:07:05 +11:00

23 lines
477 B
Go

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