如何在另一个代码节点内调用控制器模块

时间:2019-01-11 10:35:58

标签: node.js

我使用具有路由器的节点js创建了api。但是我想在cron作业代码中调用路由器动作功能。

const create = async function (req, res) {

}
module.exports.create = create;

cron.schedule('1 * * * *', function () {

 // I want to call create inside the cron code. 
  console.log('running a task');
});

0 个答案:

没有答案