Difference between app.Use, app.UseMiddleware, app.Run, and?
pp.Map
Method Description
pp.Use Adds middleware that can call next in the
pipeline.
pp.UseMiddlewar
e<T>()
dds a custom middleware class.
pp.Run Terminal middleware – does not call next. Ends
the pipeline.
pp.Map Branches the pipeline based on URL path (e.g.
/api).
Example:
pp.Use(async (context, next) => {
wait next(); // go to next middleware
});
pp.Run(async context => {
wait context.Response.WriteAsync("Hello World"); //
terminates pipeline
});