mirror of
https://github.com/labstack/echo.git
synced 2026-05-16 09:48:24 +02:00
692 B
692 B
Development Guidelines for middlewares
Best practices:
- Do not use
panicin middleware creator functions in case of invalid configuration. - In case of an error in middleware function handling request avoid using
c.Error()and returning no error instead because previous middlewares up in call chain could have logic for dealing with returned errors. - Create middleware configuration structs that implement
MiddlewareConfiguratorinterface so can decide if they want to create middleware with panics or with returning errors on configuration errors. - When adding
echo.Contextto function type or fields make it first parameter so all functions with Context looks same.