More Interactive Programming In JavaScript
Usually when writing backend JavaScript code, modern frameworks and libraries usually auto reload your application when your code changes (with tools like Webpack's Dev Server). This eliminates a lot of small steps that do not take a lot of time individually, but add up to a lot over time like clicking refresh on your browser. Additionally, editing unit tests help with quick checks. Though there are still situations when using a large framework or a fully unit test set just does not make sense, for example when evaluating the feasibility of some new ideas with a simple script.
To bridge this gap nodemon (short for node monitor) can be used to run any backend script instead of node. Firstly, install nodemon so that it can be used on any project:
npm install -g nodemon
Then just run any Node.js script replacing node with nodemon. For example, for a file from this blogs Github project:
nodemon 2018/autoReloadTester.js
Now each change will show up each time you save the file.
I already knew about nodemon and other similar tools and have used them with servers and other applications, but the idea to use it on single scripts came from this blog post.
Github Location https://github.com/Jacob-Friesen/obscurejs/blob/master/2018/autoReloadTester.js













