what’s middleware

tags: learning go programming

content

  • a Handler in a Go http server is a type that implements ServeHTTP method go-http-handler
  • a middleware is something that wraps a handler in another handler
    • it means, a middleware function takes in a handler as arguments, and returns another handler
    • a middleware’s signature:
func MyMiddleware(next http.Handler) http.Handler

up

down

reference