1 get
1-1 get传值
locahost?start=0;
ctx.request.query //后台获取
1-2 动态路由
//后台配置
router.get(/subject/:id,async ctx=>ctx.body="xxx")
ctx.request.params //后台获取动态路由的书
2 post
安装依赖
npm i koa-bodyparser -S
var Koa = require('koa');
var bodyParser = require('koa-bodyparser');
var app = new Koa();
app.use(bodyParser());
app.use(async ctx => {
ctx.body = ctx.request.body;
});