用瀏覽器(支持WebSocket)和node-inspector 調試後端(CoffeeScript,Typescript)代碼

調試效果

配置

  1. npm安裝node-inspector
    $ npm install -g node-inspector
  2. 配置gulp,gulp能夠用 gulp-node-inspector 或 用gulp-shell直接啓動node-inspector命令。css

    gulp.task 'server',()->
         nodemon({
             nodeArgs: ['--debug']   #須要開啓調試
             script: './server.coffee'
             ext: 'coffee css jade html json'
             ignore: ["assets/**/*", "public/**/*.*", "test/**/*"],
         })
     #能夠設置調試端口,忽略文件(夾),調試模式,是否保存瀏覽試更改的內容,詳細應用可查看:https://www.npmjs.com/package/node-inspector 
     gulp.task 'startDebug', shell.task ['node-inspector &'] 
    
     gulp.task 'debug',["server"], ()->
         gulp.start 'startDebug'
  3. 啓動調試模式:gulp debug ;
  4. 打開:http://127.0.0.1:8080/?port=5858 就能夠和前端代碼同樣調試了.html

相關文章
相關標籤/搜索