express has several secondary routes
Primary route
// ./routes/site2
const nuxt=require("./nuxt")
const site2=express.Router()
site2.use("/",nuxt.render)
site1 is deployed so that the entire nuxt project code is in site1/nuxt
, and the startup sequence is:
node app.js
each restart will run build
then the .nuxt
site1 generated in the site1/nuxt
directory can be displayed
// ./routes/site1/nuxt/index.js
const { Nuxt, Builder } = require("nuxt")
let config = require("./nuxt.config.js")
const nuxt = new Nuxt(config)
const builder = new Builder(nuxt)
builder.build()
module.exports = nuxt
site2 is deployed so that the entire nuxt project code is in site2/nuxt
. The startup sequence is
npm run build
package nuxt under
site2 directory site2/nuxt
directory .nuxt
node app.js
// ./routes/site2/nuxt/index.js
const { Nuxt, Builder } = require("nuxt")
let config = require("./nuxt.config.js")
config.dev = !(process.env.NODE_ENV === "production")
const nuxt = new Nuxt(config)
module.exports = nuxt
but the site2 page is not displayed until it times out.
1. The route has been tested and can reach
the question now is:
1. npm run build
will generate .nuxt
. Does nuxt.render only need
.nuxt
nuxt.config.js
2. What should I do if I don"t want to re-build all the site every time I restart the instance?