function *() {
var result = yield asyncFunction();
}
Generators are functions that can be paused and resumedexpress on steroids generators
app.use(function (req, res, next) {
var end = res.end();
res.end = function (…) { // monkey patching
… // a post-filter
res.write(…);
end();
};
next();
});
use generatorsapp.use(function(next){
return function *(){
yield next;
… // a post filter where it belongs
this.body = …;
}
});