Let's now learn how you can automatically run your code whenever changes are made in your file.
In the video above, you learnt how to automatically run your code without having to type the following command:
node filename
You added a script inside scripts in your package.json file, where the key was "start" and the value associated with the key was the following command:
node startingPointOfApplication
Now, in the Terminal window, you wrote the following command:
npm start
After that, whenever you made any changes in your file and saved it, the code written inside the file was automatically executed.
The actual syntax to run any script declared in package.json is:
npm run nameOfKeyInsideScript
You can read more about the run command from this link.
In the video above, you used the start key, which does not require any command to be written. However, if you have any other key and you want that to be executed, then you need to follow the syntax declared above and the command would be "run".