Add logging middleware

This commit is contained in:
Andrey Chervyakov 2021-03-15 01:55:06 +06:00
parent 9fe79d3f43
commit 3bbeab1199

View file

@ -21,6 +21,8 @@ func NewServer(conf *koanf.Koanf, pool *pgxpool.Pool) *echo.Echo {
func addMiddleware(s *echo.Echo, conf *koanf.Koanf) { func addMiddleware(s *echo.Echo, conf *koanf.Koanf) {
s.Use(middleware.CORS()) s.Use(middleware.CORS())
s.Use(middleware.Logger())
s.Use(middleware.JWTWithConfig(middleware.JWTConfig{ s.Use(middleware.JWTWithConfig(middleware.JWTConfig{
Skipper: func(ctx echo.Context) bool { Skipper: func(ctx echo.Context) bool {
return ctx.Request().Method == "GET" && ctx.Request().URL.Path != "/links" return ctx.Request().Method == "GET" && ctx.Request().URL.Path != "/links"