Functions
Middleware functions standardization, explanation and usage
NEMO uses Next.js native middleware function schema to provide you with a familiar way of writing middleware functions and enabling you to use 3rd party packages without any issues.
Function schema
NEMO middleware function API is fully compatible with Next.js native API. It's just extending the event prop with some additional props and functions.
Info
You can check detailed types by hovering on function parts and props.
Explanation
Prop: request
Type: NextRequest
That's a user middleware's request passed to middleware and can be later updated by functions in chain.
This props cookies will only deffer from the original user's request if you've forwarded any response it in the chain.
Prop: event
Type: NemoEvent
extends NextFetchEvent
This property contains event object for serverless functions execution extended via nemo
prop which contains chain execution shared context.
Shared context
Learn more about Shared Context in middleware