gohttpserver/httpserver/handleindex.go

18 lines
315 B
Go
Raw Normal View History

2020-09-30 06:35:07 +00:00
package httpserver
import (
"net/http"
2020-10-28 23:46:22 +00:00
"github.com/rs/zerolog/log"
2020-09-30 06:35:07 +00:00
)
func (s *server) handleIndex() http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
2020-10-28 23:46:22 +00:00
content, err := s.staticFiles.ReadFile("web/index.html")
if err != nil {
log.Fatal().Err(err).Send()
}
w.Write(content)
2020-09-30 06:35:07 +00:00
}
}