I except to do a simulation of the terminal in front and therefore to display live the messages of the sass --watch the problem is that res.render I can only do it once and what there is any way to return this multiple times?
So here my code :
app.get('/sass', function (req, res) {
path1 = req.query.chemin;
path2 = req.query.chemin;
const ls = spawn('sass', ['--watch path1 path2'], { shell: true });
ls.stdout.on('data', (data) => {
console.log(ls.pid);
message = JSON.stringify(`stdout: ${data}`);
res.render('index', { messagee: message, path: firstpath });
});
});
Front :
<div id="terminal"> <%= messagee %> </div>
My infrastructures :
server.js -views --index.ejs -public --css --js --img
Thank you for your answer