passing parameters to Node.js async waterfall
-
14-07-2021 - |
Question
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)
]
OTHER TIPS
See async.apply().
async.waterfall([
async.apply(function(req, callback) {}, req);
]);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow