Monday, 17 February 2020

How to automate a single task in Node, e.g. automatically execute a function once a day?

Hi all. I'm new to Node. I have some code in a JS file, and want to execute that code on a schedule (e.g. once per day). What are the options to do so? I'm happy using a third party package if need be.In my case, what I will be automating is sending an email. To be clear, in my JS file is code which sends a single test email (to my own mailbox), using Nodemailer. I'd like this email to be automatically sent, once per day.A web search has turned up two different Node packages that might be able to do this:node-cronnode-schedulenode-cron looks a little more up to date. Maybe someone has experience with one or either of these, and can vouch for it?Thanks in advance.

Submitted February 17, 2020 at 11:05AM by cag8f

No comments:

Post a Comment