Index
Overview


The nodemon dev tool that monitors source code and if any changes are detected the server is automatically restarted (time saver during develoment).

Installation


Install globally as shown
> npm install -g nodemon


Usage


Example 1
  • To run file "foo.js"
  • open console in project root dir
  • run command as shown
  • continue in normal way (e.g., open browser on relevant url)
> nodemon foo
Example 2
Same as previous but to start "main.js"
> nodemon main


Adding Configuration to VSCode


Here is how to add a configuration for nodemon in the VSCode IDE:

Add Configuration
Select the "Add Configuration" menu and choose Nodemon

GOTCHA -- if this is your first configuration, first choose "Node.js", and then if you do "Add Configuration" again, "Nodemon" should show up as a choice.
Run
	Add Configuration
		(choose "Node.js: Nodemon Setup")
Result
The file "launch.json" should open.

The first/top configuration should contain config similar to what is shown here.
{
    "console": "integratedTerminal",
    "internalConsoleOptions": "neverOpen",
    "name": "nodemon",
    "program": "${workspaceFolder}/app.js",
    "request": "launch",
    "restart": true,
    "runtimeExecutable": "nodemon",
    "skipFiles": [
	"<node_internals>/**"
    ],
    "type": "pwa-node"
},
Edit Configuration if Needed
One possible edit to the configuration is, e.g., specifying your specific launch file, as shown.

Otherwise, you should be good to go.

Save the file when done editing.
"program": "${workspaceFolder}/main.js",