module.exports nodejs,调用一个带参数的函数

问题描述

我正在尝试调用一个带有参数的 async/await 函数,该函数在来自 middleware.js 的 helper.js 文件中定义。

helper.js

module.exports.add = async fields => {
One,two.three} = fields;
module.exports.multiple = async fields => {
One,two.three} = fields;

中间件.js

module.exports = async (res,req) => {
const form = new formidable.IncomingForm();
await form.parse(req,(err,fields,file) => {
try{ calling function add }catch{ }
try{ calling function multiple }catch{ } 
});
};

这个语法对吗?有一个更好的方法吗?。如何通过传递参数在我的中间件中调用辅助函数加法和乘法。我正在尝试编写中间件函数,而辅助函数已经编写完毕。如果我的问题需要澄清,请告诉我。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)