update echo to v5 and prepare kontor-echo to use handlers, repository and service
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 3s
Gitea Actions Demo / build-and-test (push) Failing after 11s

This commit is contained in:
Thomas Peetz
2026-11-05 20:33:46 +01:00
parent 20e141b73e
commit 9a7219e106
5 changed files with 145 additions and 35 deletions
+33
View File
@@ -0,0 +1,33 @@
package router
import (
echojwt "github.com/labstack/echo-jwt/v5"
"github.com/labstack/echo/v5"
"github.com/labstack/echo/v5/middleware"
)
func New(admin *handlers.AdminHandler, media *handlers.MediaHandler) *echo.Router {
e := echo.New()
skipper := func(c echo.Context) bool {
// Skip health check endpoint
return c.Request().URL.Path == "/health"
}
e.Use(middleware.RequestLoggerWithConfig(middleware.RequestLoggerConfig{
LogStatus: true,
LogURI: true,
LogError: true,
HandleError: true,
Skipper: skipper,
LogValuesFunc: func(c echo.Context, v middleware.RequestLoggerValues) error {
if v.Error == nil {
slog.Info("REQUEST", "uri", v.URI, "status", v.Status)
} else {
slog.Info("REQUEST-ERROR", "uri",v.URI, "status", v.Status,"err", v.Error.Error())
}
return nil
},
}))
return e
}