liveBook · Manning

Middleware

Middleware is software that mediates communication or processing between components, often by intercepting, transforming, or coordinating operations in a pipeline.

How 13 Manning books explain it

ASP.NET Core in Action, 3e

Middleware is a request-processing component that can inspect, modify, or handle HTTP requests and responses within an ASP.NET Core pipeline.

How it is used
Uses middleware to compose request handling and cross-cutting concerns in ASP.NET Core applications.
How deep it goes
Explains two-way execution, ordering, short-circuiting, and configuration of existing components, while deferring custom middleware construction.
Examples
Demonstrates a welcome page, static-file serving, development HTTP logging, and a minimal API pipeline.
What you can do after
Operate/configure an ASP.NET Core middleware pipeline using existing components and appropriate ordering.

Read how ASP.NET Core in Action, 3e explains middleware →

Pro ASP.NET Core 7, Tenth Edition

Middleware is a component in an ASP.NET Core request pipeline that processes HTTP requests and responses.

How it is used
Processes HTTP requests and responses in an ordered ASP.NET Core pipeline, either producing responses or supplying features to later components.
How deep it goes
Builds lambda and class components, including forwarding, return-path changes, short-circuiting, thread safety, and options; delegates raw HTTP parsing to ASP.NET Core.
Examples
Uses Program.cs components that check a GET query parameter, append a status code, and expose session data through HttpContext.
What you can do after
Build it from scratch: register lambda or class middleware and control whether it forwards a request or changes its response.

Read how Pro ASP.NET Core 7, Tenth Edition explains middleware →

Go by Example

Middleware is a software pattern in which a component wraps a handler or processing component to add behavior before, after, or around the wrapped component's execution.

How it is used
Adds cross-cutting HTTP behavior around handlers without modifying route-handler code.
How deep it goes
Builds logger, duration, status-code, and trace-ID wrappers, including chaining, ResponseWriter interception, and Context caveats.
Examples
Uses a REST ServeMux, request logs, duration and status metrics, curl requests, and trace-ID propagation.
What you can do after
Build it from scratch: chain HTTP wrappers that log requests, collect response metrics, and propagate trace IDs.

Read how Go by Example explains middleware →

Building Web APIs with ASP.NET Core

Middleware is an HTTP-level component that processes a request and either passes it to the next pipeline component or produces a response.

How it is used
Handles HTTP requests through a configurable pipeline, including caching defaults and JWT authentication.
How deep it goes
Defines terminal behavior and walks through registration, a custom Use callback, and response-header checks without exploring pipeline internals.
Examples
Uses a Program.cs starter pipeline, a no-cache callback, response-header checks, and JWT authentication setup.
What you can do after
Build it from scratch by adding a Use callback in Program.cs and verifying its cache-control fallback.

Read how Building Web APIs with ASP.NET Core explains middleware →

Robotics for Programmers

Middleware is software that provides communication, composition, resource-management, deployment, and analysis services between applications or networked devices.

How it is used
Provides a collection-level API for building robot applications across networked devices.
How deep it goes
Explains middleware through distributed-system abstraction, deployment flexibility, and publish-subscribe communication without detailing internal implementations.
Examples
Uses database and web-backend deployment, image-processing placement, and detected-object publisher and subscriber code.
What you can do after
Build applications atop distributed devices through a unified collection-level API.

Read how Robotics for Programmers explains middleware →

Functional Programming in C#, Second Edition

A generic delegate type representing middleware that wraps or composes an operation in a pipeline.

How it is used
Composes setup and teardown around database operations without deeply nested callbacks.
How deep it goes
Derives the delegate shape and implements Bind, Map, and Run, including the dynamic-result trade-off.
Examples
Uses connection management, timing, and transaction-wrapped database deletes as worked examples.
What you can do after
Build it from scratch as a C# middleware delegate and compose database operations with LINQ.

Read how Functional Programming in C#, Second Edition explains middleware →

Django in Action

Middleware is software that sits in a request-processing pipeline and can modify processing or prevent a downstream handler from being called.

How it is used
Coordinates authentication, sessions, and other cross-request behavior around Django views.
How deep it goes
Defines pipeline placement and configuration, while deferring factory-function or class middleware implementation to Django documentation.
Examples
Uses session login control, a protected band page, and Debug Toolbar installation on a musician listing.
What you can do after
Operate/configure it by placing DebugToolbarMiddleware correctly and recognizing middleware as a home for repeated view logic.

Read how Django in Action explains middleware →

Learn Docker in a Month of Lunches, Second Edition

A Traefik middleware is a request-processing component that modifies or validates traffic before forwarding it to a service.

How it is used
Uses request transformations and validation between HTTP routers and upstream services.
How deep it goes
Defines path, header, and authentication uses, then demonstrates path-prefix rewriting without detailing middleware labels.
Examples
Uses an image gallery API mounted under an /api path and verified with curl.
What you can do after
Configure path rewriting for a routed container application and verify the resulting website and API requests.

Read how Learn Docker in a Month of Lunches, Second Edition explains middleware →

Secure APIs

Middleware is software that intercepts and processes requests or responses between a client and an application endpoint.

How it is used
Protects API requests by combining authentication, authorization, and business-flow checks before endpoint processing.
How deep it goes
Demonstrates implementation through a ticketing example but acknowledges that the mitigation only scratches the surface of abuse prevention.
Examples
Uses ticket checkout, allowed user agents, authenticated user claims, and 24-hour transaction records as concrete artifacts.
What you can do after
Build custom request middleware that rejects unauthorized clients and prevents repeated purchases according to application rules.

Read how Secure APIs explains middleware →

Build AI-Enhanced Web Apps

Middleware is software that intercepts and processes requests between a client and an application handler.

How it is used
Deploys middleware as an early security layer for authentication, CORS, rate limiting, and security headers.
How deep it goes
Explains sequential composition, short-circuiting, stopping, error handling, route matching, and edge placement without detailing provider internals.
Examples
Uses composable Next.js middleware, Clerk-protected chat routes, CORS checks, Upstash Redis rate limits, and authentication redirects.
What you can do after
Operate/configure Next.js request pipelines that authenticate users, restrict origins, limit traffic, set headers, and handle middleware failures.

Read how Build AI-Enhanced Web Apps explains middleware →

Rust Web Development

Middleware is software that processes a request in a pipeline before it reaches its handler.

How it is used
Places request processing between route acceptance and handler execution to check or supply information.
How deep it goes
Explains token validation and session extraction, then shows a Warp filter composed into a route.
Examples
Uses an Authorization token, a Session structure and a question-update route to illustrate middleware.
What you can do after
Apply middleware via Warp filters to validate a token and supply a session to a route handler.

Read how Rust Web Development explains middleware →

Learn Haskell by Example

Middleware is a function or component that wraps a web application to inspect or transform requests and responses before delegating to the wrapped application.

How it is used
Adds behavior or routes around a WAI Application without changing the underlying Servant API type.
How deep it goes
Defines the Application -> Application shape and works through request matching, response construction, delegation, and composition.
Examples
Uses a todo-list root page that sorts database entries, renders HTML, and leaves other requests to the API server.
What you can do after
Build it from scratch by wrapping an Application, matching requests, creating responses, and delegating unmatched traffic.

Read how Learn Haskell by Example explains middleware →

Build Financial Software with Generative AI (From Scratch)

Middleware is software that intercepts and processes requests or responses between an application and its surrounding interfaces.

How it is used
Centralizes API request logging and auditing so endpoint code stays focused and avoids repeated boilerplate.
How deep it goes
Explains registration, request-response flow, audit fields, persistence, and decorator-based customization, without covering deployment configuration.
Examples
Uses API request records, ACH-file retrieval messages, client metadata, response codes, URLs, and an AuditLog utility.
What you can do after
Operate/configure FastAPI middleware to log API calls and attach endpoint-specific audit messages.

Read how Build Financial Software with Generative AI (From Scratch) explains middleware →

Also covered in

What to know first

Related concepts

Questions about middleware

What is middleware?

Middleware is software that mediates communication or processing between components, often by intercepting, transforming, or coordinating operations in a pipeline.

Which Manning books explain middleware?

ASP.NET Core in Action, 3e, Pro ASP.NET Core 7, Tenth Edition, Go by Example, Building Web APIs with ASP.NET Core, Robotics for Programmers, Functional Programming in C#, Second Edition, Django in Action, Learn Docker in a Month of Lunches, Second Edition and 5 more.

What should I know before learning middleware?

Manning books that teach middleware usually introduce handler, HTTP request, authentication and HTTP first.

What kinds of middleware are there?

Kinds of middleware include exception-handler middleware, host filtering middleware and HSTS middleware.

What is middleware a kind of?

Middleware is a kind of monad. A monad is a programming abstraction that provides operations for sequencing computations while encapsulating and preserving their computational context.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.