How to send res to my client using cron jobs

Viewed 358

I have cron jobs launch when server start that watch and start an appointment when it's time come but I want to send data to my client through response ,is that possible in cron jobs

I am working with NodeJS and sails

crons.schedule("* * * * * *", async (req, res) => {
  res.send("appointment started")
}
2 Answers

No, you can't do this, cause you don't have access to req & res objects

As mentioned by @Yuri Vorobev, CRON jobs in Sails do not have access to req and res objects. But what you can do is call a controller method/Action in the CRON job and send response at regular intervals.

Related