ExpressJS (Javascript) / Nuxt.js
  • 27 Mar 2023
  • 1 Minute to read
  • Contributors
  • Dark
    Light
  • PDF

ExpressJS (Javascript) / Nuxt.js

  • Dark
    Light
  • PDF

Article Summary

ExpressJS (Javascript)

View source on GitHub

Run this command in your node project.

npm install prerender-node --save

And when you set up your express app:

app.use(require('prerender-node').set('prerenderToken', 'YOUR\_TOKEN'));

Using the express middleware with Nuxt.js

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

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

And the prerender-middleware.js :

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