Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将参数传递到Node.js异步瀑布_Node.js_Asynchronous_Node Async - Fatal编程技术网

将参数传递到Node.js异步瀑布

将参数传递到Node.js异步瀑布,node.js,asynchronous,node-async,Node.js,Asynchronous,Node Async,我需要将一些参数传递给的初始函数。建议的方法不适用于我,因为我需要将ExpressJS函数的响应传递给它 exports.categories = (req, res) -> async.waterfall [ (callback) -> # need req here... 看。 “这里需要请求。”你应该已经在那里了。我用它作为例子,但你是正确的。这个答案也是实现它的方法之一。async.apply(fnName,r

我需要将一些参数传递给的初始函数。建议的方法不适用于我,因为我需要将ExpressJS函数的响应传递给它

exports.categories = (req, res) ->
    async.waterfall [           
       (callback) ->
         # need req here...
看。


“这里需要请求。”你应该已经在那里了。我用它作为例子,但你是正确的。这个答案也是实现它的方法之一。async.apply(fnName,req);谢谢
async.waterfall [
  ( (req, callback) ->

  ).bind(null, req)
]
async.waterfall([
  async.apply(function(req, callback) {}, req);
]);