-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
请教一个关于中间件的运行流程问题,函数被重复执行了; #25
Comments
格式化一下代码 |
哦,不好意思Σ( ° △ °|||)︴ app.use(function *(next){
}); app.use(route.get('/products',function *(){
})); app.use(function *(){
}); other code... |
整理了下,感觉你这个是两次请求,只不过打印在一起了。你试试log this.url看请求的路径。 |
好,稍后回复 |
因为浏览器访问了fav.ico |
@zeyongTsai 添加到faq一节里 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
some code...
app.use(function *(next){
console.log("-+-+-+-+-+-+");
console.log(this.method);
yield next;
this.body = "hello world world world!";
console.log("------");
});
app.use(route.get('/products',function *(){
console.log("hahaha");
console.log(this.method);
console.log("hehehehe");
}));
app.use(function *(){
console.log('999');
this.body = "hello world!";
console.log(this.method);
console.log("++++++");
});
other code...
控制台的结果:
我想请问的是:为什么写在route前面的函数被调用了两次呢?如果放在后面的话,倒是没有这个问题;
The text was updated successfully, but these errors were encountered: