HTTP server middleware
suggest changeIntroduction
In Go, middleware can run code before and after a handler function. It uses function values, and it can be introduced at any time without affecting the other middleware. For example, authentication logging can be added in later stages of development without disturbing the existing code.
Remarks
The usual signature of middleware is func(http.Handler) http.Handler. The wrapped handler has type http.HandlerFunc, func(http.ResponseWriter, *http.Request).
Middleware Calculate time required for handlerFunc to execute
Recovery Handler to prevent server from crashing
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents