go-web-template/handlers/not_found.go
Valentin Brandl 7d18008d80
Some checks failed
Build / build (push) Successful in 1m22s
Lint / lint (push) Failing after 1m51s
Helper to render template
2025-04-20 00:27:16 +02:00

17 lines
340 B
Go

package handlers
import (
"net/http"
"github.com/rs/zerolog/hlog"
)
func (app *Application) NotFound(w http.ResponseWriter, r *http.Request) {
renderTemplate(*notFoundTemplate, nil, func(w http.ResponseWriter, r *http.Request) {
l := hlog.FromRequest(r)
l.Info().Msg("Not found")
w.WriteHeader(http.StatusNotFound)
})(w, r)
}