javascript - In NodeJs how can I wait until my http get is finished? -
this question has answer here: how return response asynchronous call? 21 answers edit: want explain problem more clearly, purpose make http response before "webot.waitrule()" returns. should http request call webot.waitrule or other way around? below code implements module in program, , problem function returns before http request response. know http requests in node js async, there solution it? pretty new in javascript , nodejs. thanks. webot.waitrule('wait_class', function(info) { var coursename='lol'; var options = { host: 'api.uwaterloo.ca', path: '/v2/courses/cs/486/examschedule.json' }; callback = function(response) { var str = ''; //another chunk of data has been recieved, append `str` response.on('data', function (chunk) { str +=...