Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var doSomething = function() {
- getDataFromAPI(function(result) {
- var funcs = [];
- results.forEach(function(value) {
- var func = function valueQuery(callback) {
- mysql.query('some good sql query to do or whatever.', callback);
- };
- funcs.push(func);
- });
- async.parallel(funcs, function(err, ok) {
- if (err) {
- // Do something with error.
- return 'back to home';
- }
- console.log(ok); // Array with 0 indexed results of each "value" variable result returned by mysql.
- });
- });
- }();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement