Next.js Discord

Discord Forum

Pass data from middleware to api route without headers

Unanswered
Chalcid wasp posted this in #help-forum
Open in Discord
Chalcid waspOP
Goals
Should be able to add at least locals object inside request object from middleware.
Should be able to access the locals object from NextPageContext and NextApiRequest


Background
While using the middleware and not using next-auth, there is not way to add user set in request in middleware.js like we do in express like req.locals.user.

1 Reply

Chalcid waspOP