Use attaches a global middleware to the router. i.e. the middleware attached through Use() will be included in the handlers chain for every single request. Even 404, 405, static files... For example, this is the right place for a logger or error management middleware.
(middleware ...HandlerFunc)
| 338 | // included in the handlers chain for every single request. Even 404, 405, static files... |
| 339 | // For example, this is the right place for a logger or error management middleware. |
| 340 | func (engine *Engine) Use(middleware ...HandlerFunc) IRoutes { |
| 341 | engine.RouterGroup.Use(middleware...) |
| 342 | engine.rebuild404Handlers() |
| 343 | engine.rebuild405Handlers() |
| 344 | return engine |
| 345 | } |
| 346 | |
| 347 | // With returns an Engine with the configuration set in the OptionFunc. |
| 348 | func (engine *Engine) With(opts ...OptionFunc) *Engine { |
nothing calls this directly
no test coverage detected