I’ve been using nodemon every time I’ve worked on any node projects, and its a well known tool. I want to shine a light onto one very specific feature of nodemon, and that is watching directories and changes of any kind of files.
nodemon helps you develop node.js apps by automatically restarting the application every time it detects file changes. What’s great about it is that it doesn’t make you do any setup - you simply run your node app through
nodemon - it wraps the node executable and you’re good to go. Where you would run
node app.js you just run
nodemon app.js and Bob’s your uncle.
The cool bit
It’s all good, but I’m not here to copy-paste the docs for nodemon. What I want to draw your attention to is how I ended up using nodemon in my
~/.zshrc to use it in my python and ruby projects:
alias pyno="nodemon -exec python3" alias runo="nodemon -exec ruby
Since nodemon enables listening to any kind of file being modified you can ask it to observe other file extensions.
That enables me to jump into a project and shout
pyno app.py and have the file re-run every time I save or modify any
.py file in the directory. I’ve found this to be mostly useful when working on small things and scripts, or challenges like aoc.
Hope you’ll find it useful!