兩個中間件之間如何傳值呢
test.post('/', koaBody, function* (next) {
var body = this.request.body;
console.log(body);
yield body;
yield next;
})
app.use(function* (next) {
this.body="sucessful";
console.log("中间件2");
yield this.mongo.db('app_info').collection('platform').insert({"xiaoming":"xiaoming1"});
this.body= this.mongo.db('app_info').collection('platform').findOne();
});
如上,我想把第一個中間件的post獲取的body,傳入第二個中間件中,然後由第二個中間件存入monodb。請問我該如何取得?