koa-book icon indicating copy to clipboard operation
koa-book copied to clipboard

koa的路由问题

Open maomaoking opened this issue 9 years ago • 1 comments

根据书中例子 我在demo.js 中写了 app.use(function *(){ this.demo = 'test text'; }); app.use(function *(){ this.body = this.demo; }); 但是 貌似 运行的时候,没有进入第二个 ,页面显示 no found 求大神给看一下原因

maomaoking avatar Jan 14 '16 03:01 maomaoking

app.use(function *(next){
  this.demo = 'test text';
  yield next;
});
app.use(function *(){
  this.body = this.demo;
});

原书代码有问题。

hacke2 avatar Jan 15 '16 11:01 hacke2