4

假设我想在不使用扩展程序的情况下将一个简单的变量发布到 Koa 应用程序,我该怎么做?

4

1 回答 1

4

您必须使用官方koa-bodyparser模块。

然后所有POST参数将在this.request.body.


从文档:

app.use(function *() {
  // the parsed body will store in this.request.body
  // if nothing was parsed, body will be an empty object {}
  this.body = this.request.body;
});
于 2015-11-10T14:15:47.550 回答