alsotang / node-lessons

:closed_book:《Node.js 包教不包会》 by alsotang
16.54k stars 4.7k forks source link

lesson2里能否介绍下如何处理直接访问错误? #48

Closed ipfans closed 9 years ago

ipfans commented 9 years ago

比如var q = req.query.q;这个取到undefined,如何解决这个错误?

alsotang commented 9 years ago

if 判断一下就好了,最基本的空值判断。

2015-07-21 14:11 GMT+08:00 ipfans notifications@github.com:

比如var q = req.query.q;这个取到undefined,如何解决这个错误?

— Reply to this email directly or view it on GitHub https://github.com/alsotang/node-lessons/issues/48.