2014-04-23 1 views
0

내 node.js 앱에서 문고 쿼리에 오류가 발생하면 res.end를 사용합니다. 하지만 코드는 계속 실행되며 res.end 이후에 리턴해야합니까?문답 오류를 사용해야합니까

book.find({key:'123'},function(err){ 
    if(err) res.end(); 
    console.log("lots of blah blah"); 
}); 

답변

0

"어쩌구"를 중지하려면 return res.end();이어야합니다.

뭔가 같은 :

book.find({key:'123'},function(err){ 
    if(err) return res.end(); 
    console.log("lots of blah blah"); 
}); 
관련 문제