liveBook · Manning

Middleware endpoint

As explained in ASP.NET Core in Action, 3e

A middleware endpoint is an addressable endpoint whose response processing is implemented by a dedicated middleware pipeline.

A middleware endpoint is an addressable route whose response is produced by a dedicated middleware pipeline. Endpoint routing selects it, exposes its metadata, and lets middleware such as authorization act before execution. section 31.1.5

A protected ping endpoint

Define MapPingPong("/ping") to construct the middleware pipeline, map it to /ping, and require authorization. Requests reaching the authorized endpoint receive the middleware's "pong" response.

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains middleware construction, miniature pipeline building, route mapping, metadata, and authorization, without detailing middleware internals.
Examples
Uses a PingPongMiddleware that returns pong at /ping and demonstrates a reusable MapPingPong extension.
What it assumes
Assumes familiarity with custom middleware and introduces the conversion from middleware branching to endpoint routing.
What you can do after
Build it from scratch by wrapping middleware in an endpoint pipeline, mapping a route, and attaching authorization.
How it connects
Connects middleware pipelines with endpoint routing, authorization middleware, minimal APIs, and route mapping.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.