const Koa = require('koa'),
app = new Koa(),
Router = require('koa-router'),
router = new Router();
app.use(router.routes());
app.use(ctx => {
ctx.body = 'Hello World';
});
app.listen(8000);
没有报错,但是报出一条警告:
koa deprecated Support for generators will be removed in v3. See the documentation for examples of how to convert old middleware https://github.com/koajs/koa/blob/master/docs/migration.md server.js:6:5
OK, 那么就是app.use(router.routes());
这里写的不好,那么应该怎么写才对呢?事实上我甚至不太清楚这句话是做什么的~
求教,谢谢~