I'd be tempted to use nodemon...
Once installed (with npm install -g nodemon
), instead of starting your server with say node app.js
- start it with nodemon app.js
.
Nodemon will listen for any changes to your files, and restart your server automatically for you. Perfect for development!
If this, for some reason, is not an option though, you could use something like the taskkill command to kill all the node processes with something like taskkill /F /IM node.exe
I'm not a Windows Guru though, so there's will likely be a better way of doing this with something like a batch script or windows service (rather than just killing ALL node apps)
Perhaps someone on StackOverflow with more Windows experience can help out here.
Good luck!