一 ctx.onerror is not a function
TypeError: ctx.onerror is not a function
at onerror (/Users/xiexingjie/Developer/mcn/demo/server/node_modules/koa/lib/application.js:179:32)
at AsyncResource.runInAsyncScope (async_hooks.js:197:9)
at listener (/Users/xiexingjie/Developer/mcn/demo/server/node_modules/on-finished/index.js:170:15)
at onFinish (/Users/xiexingjie/Developer/mcn/demo/server/node_modules/on-finished/index.js:101:5)
at callback (/Users/xiexingjie/Developer/mcn/demo/server/node_modules/ee-first/index.js:55:10)
at ServerResponse.onevent (/Users/xiexingjie/Developer/mcn/demo/server/node_modules/ee-first/index.js:93:5)
at ServerResponse.emit (events.js:412:35)
at ServerResponse.emit (domain.js:475:12)
at onFinish (_http_outgoing.js:792:10)
at callback (internal/streams/writable.js:513:21)
[ERROR] 10:08:53 TypeError: ctx.onerror is not a function
原因: 使用koa-bodyparser错误,koa-bodyparser是个方法
const bodyParser = require("koa-bodyparser");
//错误
app.use(bodyParser);
// 正确
app.use(bodyParser());