Node(Nuxt.js)
  • 20 Jun 2024
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

Node(Nuxt.js)

  • Dark
    Light
  • PDF

Article summary

Using the express middleware with Nuxt.js

This NuxtJS integration is only compatible with NuxtJs 2 and is not compatible with NuxtJs 3 or newer. 


View source on GitHub

Run this command in your project.

npm install prerender-node --save

In the nuxt.config.js add a new middleware:

serverMiddleware: [
    '~/prerender-middleware.js'
]

And the prerender-middleware.js :

Prerender token 
The location of the Prerender token has changed. You can find it under the Security and Access menu under Prerender Token.
const express = require('express')
const app = express();

app.use(require('prerender-node').set('prerenderToken', 'API TOKEN'));

module.exports = {
  path: '/',
  handler: app
}

Was this article helpful?

What's Next