我怎样才能debugging节点模块?
我正在考虑参与相当令人兴奋的node.js,但是我正在设法取代我当前的开发环境。
目前,PHPLand中我最好的朋友是Firebug的FirePHP模块,这是一个神的发送,只要debugging你的PHP去。 我有什么方法来debugging节点代码? 它是否输出错误和像PHP一样的警告可以设置?
有多种debugging节点的方法。
-
node debug app.js
- 节点检查
-
console
-
util
就我个人而言,我在代码中使用了很多的console.log
, console.dir
和util.inspect
语句,并遵循这种逻辑。
当然,unit testing与debugging结合在一起。 写testing,断言你的代码工作。 unit testing将覆盖大部分的错误。
你必须为你的node.js代码编写unit testing。 nodeunit
对通用testing非常nodeunit
。
如果您使用快递作为您的网页引擎,然后使用expresso