Skip to content

Out-of-the-Box Middleware



Middleware is the concept that refers to a layer of code that lies between your handler and the caller using the IMediator. It provides you with a before and after hook to do things like logging, caching, error handling, etc. You can mutate the results or short circuit it if necessary.

Our middleware follows the same general principles from ASP.NET Core. Shiny Mediator supports middleware for both requests and events, however, they are two separate pipelines.

As with ASP.NET Core, when you’re implementing middleware, you have a next parameter that you must call to continue the pipeline.