nuxt.renderRoute(route, context)
Render a specific route with a given context.
- 
Type: Function
- 
Arguments:
- 
String: route to render
- 
Optional, Object, context given, available keys:req&res
 
- 
- 
Returns: Promise- 
html:String
- 
error:nullorObject
- 
redirected:falseorObject
 
- 
This method should be used mostly for test purposes as well as with nuxt.renderAndGetWindow .
nuxt.renderRoute should be executed after the build process in production mode.const { loadNuxt, build } = require('nuxt')
async function start() {
  // Get nuxt instance for start (production mode)
  // Make sure to have run `nuxt build` before running this script
  const nuxt = await loadNuxt({ for: 'start' })
  const { html, error, redirected } = await nuxt.renderRoute('/')
  // `html` will always be a string
  // `error` not null when the error layout is displayed, the error format is:
  // { statusCode: 500, message: 'My error message' }
  // `redirected` is not `false` when `redirect()` has been used in `asyncData()` or `fetch()`
  // { path: '/other-path', query: {}, status: 302 }
}
start()
 
        Edit this page on GitHub
        
      Updated at Mon, Feb 28, 2022
    
  Leoš Literák
 
        Leoš Literák
        Trizotti
 
        Trizotti
        Clément Ollivier
 
        Clément Ollivier
        Sébastien Chopin
 
        Sébastien Chopin
        Marcello Bachechi
 
        Marcello Bachechi
        Rodolphe
 
        Rodolphe
        Thomas Underwood
 
        Thomas Underwood
        Shek Evgeniy
 
        Shek Evgeniy
        felipesuri
 
        felipesuri
        Lukasz Formela
 
        Lukasz Formela
        Hugo Torzuoli
 
        Hugo Torzuoli
        Sylvain Marroufin
 
        Sylvain Marroufin
        Kareem Dabbeet
 
        Kareem Dabbeet
        tramplay
 
        tramplay
        Daniel Roe
 
        Daniel Roe
        verebelyicsaba
 
        verebelyicsaba
        Adam
 
        Adam
        Nate Butler
 
        Nate Butler
        Sandra Rodgers
 
        Sandra Rodgers
        Arpit Patidar
 
        Arpit Patidar
        Matthew Kuehn
 
        Matthew Kuehn
        Steven DUBOIS
 
        Steven DUBOIS
        Travis Lindsey
 
        Travis Lindsey
        syagawa
 
        syagawa
        Maxime
 
        Maxime
        かる
 
        かる
        Al Power
 
        Al Power
        Florent Delerue
 
        Florent Delerue
        quanghm
 
        quanghm
        José Manuel Casani Guerra
 
        José Manuel Casani Guerra
        Unai Mengual
 
        Unai Mengual
        kazuya kawaguchi
 
        kazuya kawaguchi
        Michael Lynch
 
        Michael Lynch
        Tomachi
 
        Tomachi
        pooya parsa
 
        pooya parsa
        Meir Roth
 
        Meir Roth
        Brett
 
        Brett
        Adam Miedema
 
        Adam Miedema
        Thomas Bnt
 
        Thomas Bnt
        Kazuki Furukawa
 
        Kazuki Furukawa
        Anthony Ruelle
 
        Anthony Ruelle
        Christophe Carvalho Vilas-Boas
 
        Christophe Carvalho Vilas-Boas
        Roman Harmyder
 
        Roman Harmyder