Step 3

Adding nodemon

Let's add hot reloading! There is a package called "nodemon" that will do this for us:

$ npm i -D nodemon

Inside the "package.json" file, change the "main" and "scripts" sections to the following:

...
    "main": "src/index.js"
...
    "scripts": {
		"start": "node src/index.js",
		"dev": "nodemon -w src",
		"test": "echo \"Error: no test specified\" && exit 1"
	},
...

That's it! Now to run the server:

$ npm run dev

Last updated

Was this helpful?