We usually need to rerun
node server.js when debugging Node.js project, which is painful and inefficient. Actually we can use nodemon to automatically restart node by monitoring the files change.
npm install -g nodemon
The simplest way is to replace node with nodemon to start your Node.js application. nodemon will watch the files in the directory in which nodemon was started, and if any files change, nodemon will automatically restart your node application.
For more advanced usage like: monitoring multiple directories, running non-node scripts..., you may reference: https://github.com/remy/nodemon.