用express、mongodb、nodejs開發簡單的登陸

原文http://my.oschina.net/chenhao901007/blog/312367


  1. 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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章