Search code examples
node.jsasynchronousnode-async

passing parameters to Node.js async waterfall


I need to pass some parameters to the initial function of async waterfall(). The proposed method https://github.com/caolan/async/issues/14 does not work for me as I need to pass it the response from an ExpressJS function

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

Solution

  • async.waterfall [
      ( (req, callback) ->
    
      ).bind(null, req)
    ]