我有一个带有议程 js 调度功能的模块。我想在另一个文件中获得该函数的结果。
为了更清楚,这是我的代码。议程.js 文件:
agenda.define("send", { priority: "high" },async function sendSMS(job){
const { names,msg } = job.attrs.data;
try {
const result=await sms.send({
to:names,
message:msg
});
return result()
//console.log(result)
} catch (error) {
console.log(error)
}
});
我想得到结果的路线:
router.post('/',(req,res)=>{
let {contacts,message,recur,date} = req.body
const names = contacts.split(',')
if(!date){
date = new Date()
}
const result = schedule(names,message,recur,date)
console.log(result)
res.send('Message sent')
})
'''
Any assistance or alternative suggestions will be welcome. Thank you