node.js - how to run a fuction in series NODEJS -


i using async waterfall model execute functions in sequence. however, within each function not execute statement in series. instance below

var serviceconfig = loadcsv(); callback(null, serviceconfig); 

i want callback execute when loadcsv() function returns value looks continue execution

apiroutes.get('/api/:service/:subject', function(req, res) {  async.waterfall([   function(callback){     var serviceconfig = loadcsv();     callback(null, serviceconfig);    },   function(serviceconfig, callback){     console.log("serviceconfig final: " + serviceconfig);     callback(null, 'd');   },   function(argd, callback){         }], function (err, result) {    } )   }); 

you could, if possible you, send callback loadcsv, , let handle it.

var serviceconfig = loadcsv(callback);

and in loadcsv:

function loadcsv(callback) {     // code     callback(null, result); } 

Comments

Popular posts from this blog

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

linux - disk space limitation when creating war file -

How to provide Authorization & Authentication using Asp.net, C#? -