控制器
async add() {
const { ctx } = this;
ctx.body = {
code: 200,
data: ctx.request.body,
};
}
路由
module.exports = app => {
const { router, controller } = app;
router.post('/api/post/', controller.home.add);
};
async add() {
const { ctx } = this;
ctx.body = {
code: 200,
data: ctx.request.body,
};
}
module.exports = app => {
const { router, controller } = app;
router.post('/api/post/', controller.home.add);
};