How to create a function that is executed for example every 5 minutes in nodejs.
I found the lib: link but I do not know how to make it run always, and not just once
How to create a function that is executed for example every 5 minutes in nodejs.
I found the lib: link but I do not know how to make it run always, and not just once
I use the cron lib and it has worked very well.
But you can also do this with pure JavaScript, just use the setInternal function.
setInterval(function () {
console.log('Isto aqui vai ser executado a cada 5 minutos');
}, 5 * 60 * 1000); //300.000, o que corresponde a 5 minutos