Assuming I have a Koa web server with an endpoint like this:
const perform = require(...); // some generator function exports.endpoint = function* () {
co turns the generator function to Promises, and executes them async. Promise.all waits for all of them to finish:
co
Promise.all
exports.getResults = function* () { var actions = [...]; return yield Promise.all(actions.map(function(action) { return co(function*() { return yield perform(action); } })); }