~netlandish/gobwebs

436d844e70e8af1bf2668cdb896fb30cf3f0a77b — Peter Sanchez 2 years ago 60c21cb
Adding simple middleware helper
1 files changed, 6 insertions(+), 0 deletions(-)

M server/server.go
M server/server.go => server/server.go +6 -0
@@ 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)