0

Could not find a trace over the network.

Is there a way to load Nuxt project as a middleware for other express server?

The documentation is just explaining how to run the nuxt-server. (I'm familiar with the 'static' option, but I would like to keep the SSR behavior)

I've transferred my Vue (non-nuxt) application to Nuxt, so I already have a server infrastructure that the nuxt-production-server is interrupting, so I would like to load a build or middleware to my existing express server.

Thanks in advance.

Adi Darachi
  • 2,137
  • 1
  • 16
  • 29

1 Answers1

2

Yes, it's possible. See official nuxt template -> https://github.com/nuxt-community/express-template

Or you can use something like this

const { Nuxt } = require('nuxt')
const config = require('./nuxt.config.js')
const nuxt = new Nuxt(config)
const app = require('express')()
app.use((req, res) => setTimeout(() => {
  return nuxt.render(req, res)
}, 0))
app.listen(port, '0.0.0.0')
Aldarund
  • 17,312
  • 5
  • 73
  • 104