Running nodemon on Mac OSX
While developing my Pomodoro Technique app, I came across something in the tutorial I’m following that I need to make a note of for future reference.
The tutorial shows you how to develop a web app that makes use of a database using the Node,js framework Express. The app is developed initially on localhost; Express sets all this up for you. However, I discovered very early on that it was incredibly tedious to have to restart the server every time a change was made in the source code. Luckily, the tutorial has this covered: use nodemon,
a utility that will monitor for any changes in your source and automatically restart your server. [nodemon website] This sounded perfect.
The server is started by a command which differs slightly, depending on whether it is run on Windows or Mac/Linux:
SET DEBUG=express-locallibrary-tutorial:* & npm start
DEBUG=express-locallibrary-tutorial:* npm start
So far, so good. When using nodemon, the command is modified. The tutorial only gives the Windows version:
SET DEBUG=express-locallibrary-tutorial:* & npm run devstart
Now, call me stupid, but I can’t remember this command, let alone convert it to the Mac version without looking it up every time — and remembering where to look it up every time. So I’m making a note of it here, in the hope that I will be able to find it easily if I need to:
DEBUG=express-locallibrary-tutorial:* npm run devstart
Now all I have to do is copy and paste the command to my terminal window and change the name of the app.