i used to use the generator function, and it is really easy to use. when i want to do multiple asynchronous calls, i just simple use code like this
// all calls will be execute in the same time (no wait)
const resultA = yield callServiceA()
const resultB = yield callServiceB()
const resultC = yield callServiceC()
if (resultA && resultB && resultC) {
// we got results from all services now,
}
how to migrate the code above to use async
and await
keyword on node.js version 7 or above