24 lines
485 B
Go
24 lines
485 B
Go
|
package handlers
|
||
|
|
||
|
import (
|
||
|
"net/http"
|
||
|
|
||
|
"github.com/rs/zerolog/hlog"
|
||
|
)
|
||
|
|
||
|
func (app *Application) NotFound(w http.ResponseWriter, r *http.Request) {
|
||
|
l := hlog.FromRequest(r)
|
||
|
l.Info().Msg("Not found")
|
||
|
|
||
|
reqId := RequestID(r)
|
||
|
w.WriteHeader(http.StatusNotFound)
|
||
|
|
||
|
err := notFoundTemplate.Execute(w, templateData{
|
||
|
RequestID: reqId,
|
||
|
})
|
||
|
if err != nil {
|
||
|
l.Error().Err(err).Msg("error executing template")
|
||
|
http.Error(w, "Internal Server Error", http.StatusInternalServerError)
|
||
|
}
|
||
|
}
|