Gherman
Gherman

Reputation: 7406

How do I access express req inside next.js App

Suppose I have a middleware that adds some data fields to express.js req object. I want to inject these fields into my React components through my Next.js _app.js implementation. How do I access req inside _app.js?

Upvotes: 3

Views: 1591

Answers (1)

evgeni fotia
evgeni fotia

Reputation: 4810

try this static async getInitialProps({ Component, ctx }) { and inside the function ctx.req

Upvotes: 3

Related Questions