Files
tuukoti-cli/templates/http/default.go
2022-07-22 14:04:10 +01:00

26 lines
446 B
Go

package http
import (
"net/http"
"github.com/labstack/echo/v4"
)
func (h *HTTP) DefaultHandler(c echo.Context) error {
return c.Render(http.StatusOK, "index.html", nil)
}
func (h *HTTP) DefaultErrorHandler(err error, c echo.Context) {
code := http.StatusInternalServerError
if he, ok := err.(*echo.HTTPError); ok {
code = he.Code
}
h.log.Error(err)
err = c.Render(code, "error.html", nil)
if err != nil {
h.log.Error(err)
}
}