Async.waterfall returning async

923 Views Asked by At

I am trying to use async.waterfall to create a response in my express services. Here is my code:

var getUserObject = function(id, res) {
  'use strict';
  async.waterfall([
    function(callback) {
      getCompleteUserObject(callback, id);
    }
  ], function(err, result) {
    res.json(result.user);
  });
  // Function returns here
};

I want my return statement to be the res.json(result.user), but the waterfall function always returns where I have the commented code above. I use series and parallel function all the time and they work find. What am I doing wrong?

0

There are 0 best solutions below