post请求
/app/config/config.default.js
config.security = {
csrf: {
enable: false
}
}
//关闭csrf就可以获取post请求的数据
获取post 请求数据
'use strict';
const Controller = require('egg').Controller;
class LoginController extends Controller {
async index() {
const { ctx } = this;
ctx.body = 'hi, login';
console.log(ctx.request.body);
}
}
module.exports = LoginController;