I have a server.js file who start my nuxt SSR website. First load of the website is a bit slow but it's ok. The time to start and finish the 'npm run start' command take around 8secs then the app is ready for every other users. Around 5 minutes laters, if nobody come on the website, it's seems to go in standby... New users will have to wait around 8 seconds, the time the 'npm run start' need to be ready again.
So my question, how can i keep my nuxt.js website awake so it nobody have to wait for the restart?
The server.js file is below.
I use plesk (windows).
const express = require("express");
const {
loadNuxt
} = require("nuxt");
const config = require("./nuxt.config.js");
const app = express();
config.dev = false;
async function start() {
const nuxt = await loadNuxt("start");
app.use(nuxt.render);
app.listen(process.env.PORT || 3000);
}
start();
Well, i solved my problem... It was not a nuxt problem but a plesk/ IIS problem ( idle timeout iisnode exactly).
If you have similar issue, have a look at this page : iisnode making the node process always working