Forward
Documentation for forward functions in NEMO
Forward functions in NEMO allow you to forward the response from one middleware function to another. This can be useful for chaining middleware functions together and creating more complex middleware logic.
Forward Function Schema
This example shows how to use the forward function in a middleware.
Explanation
Prop: forward
Type: (response: MiddlewareReturn) => void
The forward
function allows you to forward the response from one middleware function to another. This can be useful for chaining middleware functions together and creating more complex middleware logic.
Example Usage
In this example, the firstMiddleware
logs a message and forwards the response to the secondMiddleware
, which logs another message and returns the response.
The forward
function should be called with the response object that you want to forward to the next middleware function.