【发布时间】:2014-09-25 15:48:38
【问题描述】:
要了解有关 heroku 调度的更多信息,我阅读了this 帖子并构建了其中描述的应用程序。这篇文章的关键部分是当我能够heroku run numCheck 和code within the numCheck file 执行。在测试 heroku run numCheck 工作后,我能够很好地安排 Heroku 中定期发生的事件。
我使用yo angular-fullstack 创建了我的应用程序Angel Insights,它可以正常工作。但是我想添加 heroku 调度功能,但我被卡住了。我的问题是运行grunt build 后,我无法在Dist 文件夹中运行heroku run refresh。这是我专门尝试过的...
- 在 Grunt 构建之前添加了 bin/refresh(刷新下面的代码)
- 在 grunt build 后将 bin/refresh 直接添加到 Dist 文件夹中
- 在 git push heroku master 之后尝试 heroku run anyFile 两次尝试
````````
#!/usr/bin/env node
var sendgrid = require('sendgrid')(
process.env.SENDGRID_USERNAME,
process.env.SENDGRID_PASSWORD
);
var num1 = Math.ceil(Math.random() * 100);
var num2 = Math.ceil(Math.random() * 100);
var comparator;
if (num1 > num2) {
comparator = "greater than";
} else if (num1 < num2) {
comparator = "less than";
} else {
comparator = "equal to";
}
sendgrid.send({
to: 'andrewscheuermann@gmail.com',
from: 'scheduler@tester.com',
subject: 'Num1 v Num2',
text: (num1 + ' is ' + comparator + " " + num2 + ".")
}, function(err, json) {
if (err) {
console.error(err);
}
我真的被困住了,任何见解都非常感谢!
【问题讨论】:
标签: javascript node.js angularjs heroku yeoman