The Website is hosted on Heroku Servers and Using Clever cloud MySql Database for storing user data Let's Go
nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.
nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node
. To use nodemon
, replace the word node
on the command line when executing your script.
Either through cloning with git or by using npm (the recommended way):
npm install -g nodemon
And nodemon will be installed globally to your system path.
You can also install nodemon as a development dependency:
npm install --save-dev nodemon
git clone https://github.com/Harshadjoshi01/AtmSimulator.git
cd AtmSimulator
npm i
Running nodemon sever
nodemon start
With a local installation, nodemon will not be available in your system path. Instead, the local installation of nodemon can be run by calling it from within an npm script (such as npm start
) or using npx nodemon
.
Now the application will run in localhost 3000 port by default. If it's port 3000 then go to your browser => "localhost:3000"
In some networked environments (such as a container running nodemon reading across a mounted drive), you will need to use the legacyWatch: true
which enables Chokidar's polling.
Via the CLI, use either --legacy-watch
or -L
for short:
nodemon -L
Though this should be a last resort as it will poll every file it can find.
In some situations, you may want to wait until a number of files have changed. The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple times unnecessarily.
To add an extra throttle, or delay restarting, use the --delay
command:
nodemon --delay 10 server.js
For more precision, milliseconds can be specified. Either as a float:
nodemon --delay 2.5 server.js
Or using the time specifier (ms):
nodemon --delay 2500ms server.js
The delay figure is number of seconds (or milliseconds, if specified) to delay before restarting. So nodemon will only restart your app the given number of seconds after the last file change.
If you are setting this value in nodemon.json
, the value will always be interpreted in milliseconds. E.g., the following are equivalent:
nodemon --delay 2.5
{
"delay": 2500
}
- Fewer flags is better
- Works across all platforms
- Fewer features
- Let individuals build on top of nodemon
- Offer all CLI functionality as an API
- Contributions must have and pass tests
Nodemon is not perfect, and CLI arguments has sprawled beyond where I'm completely happy, but perhaps it can be reduced a little one day.
Thanks to ~ 🙏