23 lines
540 B
Go
23 lines
540 B
Go
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"git.haelnorr.com/h/golib/hws"
|
|
"git.haelnorr.com/h/oslstats/internal/throw"
|
|
homeview "git.haelnorr.com/h/oslstats/internal/view/homeview"
|
|
)
|
|
|
|
// 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 != "/" {
|
|
throw.NotFound(s, w, r, r.URL.Path)
|
|
}
|
|
renderSafely(homeview.IndexPage(), s, r, w)
|
|
},
|
|
)
|
|
}
|