Sails js - 每次都检查数据库 [英] sails js - check database every time

查看:33
本文介绍了Sails js - 每次都检查数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个日程管理器 Web 应用程序,系统将每小时检查当前时间是否超过存储在数据库中的截止日期,如果当前时间超过截止日期,即使用户没有打开也会发送电子邮件网络应用程序.单靠sails js可以做这样的事情吗?

I have a schedule manager web application where the system will check every hour if current time is passing the due date that stored in database and will send an email if the current time pass the due date even if the user doesn't open the web app. Can sails js alone do something like this?

推荐答案

您可能想要安排一个 cron 作业,该作业以设定的时间间隔执行脚本来为您执行此操作.

You'll probably want to schedule a cron job which executes a script at a set interval to do this for you.

您可以阅读 cron 并决定什么最适合您;通常,您可能希望拥有一个可从命令行执行的单独脚本(例如您可以使用 node send_emails.js 执行的 send_emails.js).

You can read up on cron and decide what works best for you; in general you'll probably want to have a separate script that is executable from the command line (such as a send_emails.js which you can execute with node send_emails.js).

这篇关于Sails js - 每次都检查数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆