Home

Issue: 3098

Feature: nuxt.render should have a third param - context

[issue link]

I think nuxt.render(req, res) method should get a third param for context. Ideally it should be merged with the existing ctx or could be called something different and added as an attribute to ctx.

Rationale:

When needing to pass additional data to the context, right now the only way is to use hacks such as adding attributes to the request or response object.

E.g.:

request.user = user
await NuxtService.render(request, response)

It’d be nice to have a more formal way of passing these datum to the Nuxt context:

Example:

await NuxtService.render(request, response, { user })
This feature request is available on Nuxt.js community (#c2682)