原文http://my.oschina.net/chenhao901007/blog/312367
npm i -g express serve-favicon morgan cookie-parser body-parser kerberos mongoose
(注意:kerberos不安裝,mongoose會卡住)
2. 調試
下面講講如何調試服務器端的代碼:
我們最好藉助一個叫node-inspector的工具包
npm i -g node-inspector //安裝node-inspector
然後在cmd裏運行
node-inspector
再新打開一個cmd,cd到項目hello-world目錄下
node --debug ./bin/www (或者 node --debug-brk ./bin/www , 舊版本express創建的node程序請使用 node --debug app.js)
在瀏覽器裏打開http://127.0.0.1:8080/debug?port=5858
再新建窗口打開http://127.0.0.1:3000/
就在瀏覽器可以調試服務器端代碼。
git clone https://github.com/guille/chat-example.git