gohttpserver/httpserver/handleindex.go

18 lines
315 B
Go

package httpserver
import (
"net/http"
"github.com/rs/zerolog/log"
)
func (s *server) handleIndex() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
content, err := s.staticFiles.ReadFile("web/index.html")
if err != nil {
log.Fatal().Err(err).Send()
}
w.Write(content)
}
}