Home

Issue: 1627

How do we pass data from Express middleware to nuxt.render?

[issue link]

For example, I’m convertin a back-end Handlebars route to using Vue/Nuxt. Before I had

app.use(session(...))

app.get('/route', (req, res) => {
  res.render('foo')
})

where somehow the user data property is available to use inside the foo Handlebar view thanks to the session() middleware.

However, now I have

app.use(session(...))

app.get('/route', nuxt.render)

which automatically renders pages/route.vue, but I’m not sure how to get the user property from the session() middleware to use it in the route.vue page.

Is there a way?

This question is available on Nuxt.js community (#c1457)