From 436d844e70e8af1bf2668cdb896fb30cf3f0a77b Mon Sep 17 00:00:00 2001 From: Peter Sanchez Date: Thu, 26 May 2022 05:27:28 -0600 Subject: [PATCH] Adding simple middleware helper --- server/server.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/server.go b/server/server.go index 760c6e0..9da7200 100644 --- a/server/server.go +++ b/server/server.go @@ -220,6 +220,12 @@ func (s *Server) WithDefaultMiddleware() *Server { return s } +// WithMiddleware add user-defined middleware to the server +func (s *Server) WithMiddleware(middlewares ...echo.MiddlewareFunc) *Server { + s.e.Use(middlewares...) + return s +} + // LogErrorFunc ... func (s *Server) LogErrorFunc(c echo.Context, err error, stack []byte) error { fmt.Println(stack) -- 2.45.2