Context Data

You can share data across middleware via context data.

Set

Set data on the context to be used by a middleware down the chain. This data is isolated to the context for the current request.

c.set("key", "value");

Get

Get data from the context that was set by a previous middleware.

const value = c.get("key");