Middleware
The powerful and flexible way to reuse logic across procedures in oRPC.
Introduction
Middleware in oRPC is both powerful and flexible, enabling you to accomplish many tasks efficiently.
Typed Input
Middleware can expect specific input types, opening up many possibilities:
Concatenation
You can merge or extend middlewares using concatenation:
Extra Context
Extra context is created by middlewares and automatically merges with the global context, enhancing developer experience:
Output
Middleware can directly output data to the client without invoking the handler. This is particularly useful for scenarios such as caching responses or pre-processing the output before sending it to the client.