0PricingLogin
Go Academy · Lesson

Middleware Pattern

Chaining handlers for logging and auth

What is middleware?

Middleware is a function that wraps an http.Handler to add cross-cutting behaviour (logging, auth, recovery) without modifying the handler's business logic.

Middleware signature

A middleware is a function that takes an http.Handler and returns an http.Handler:

type Middleware func(http.Handler) http.Handler

All lessons in this course

  1. Creating an HTTP Server
  2. Routing and Path Parameters
  3. Middleware Pattern
  4. Graceful Shutdown
← Back to Go Academy