To be able to debug & reload for node apps (e.g. express), here are some steps:
npm install -g nodemon
npm install -g node-inspector
- When running your app, instead of
node app.js, you can now runnodemon app.jsand it will restart the app on change. - To run in debug mode, start your app with
nodemon --debug app.js. Then start node-inspectornode-inspector. - Use the
localhostURL provided by node-inspector to view your app in the console. - When you want to debug, put a
debuggerstatement in your code. When you refresh your browser (on your app process), node-inspector will break at that point and allow you to debug.