Static GitHub Issues

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

prev: [Feature request]: Create nested Layouts
next: How to use dynamic NON-async components for nuxt generate

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 })
<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This feature request is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2682">#c2682</a>)</em></sub></div>