How to install nodemon?
Nodemon Installation
how to use nodemon to run nodexpress app
To use Nodemon to run your Node.jsExpress app, follow these steps:
Install Nodemon: First, you need to install Nodemon globally or as a development dependency. You can do this using npm or yarn:
npm install -g nodemonĀ # Global installation
or
npm install --save-dev nodemonĀ # Local installation
Create a Script in package.json: Add a script to your package.json file to run your Express app with Nodemon:
json
{
"scripts": {
"start": "nodemon server.js"
}
}
Replace server.js with the name of your main Express file.
Run the Script: Use the following command to start your app:
npm start
Nodemon will watch for changes in your files and automatically restart the server when a change is detected.
Make Changes and Test: Now, whenever you make changes to your code, Nodemon will restart the server, and you can test the changes in your browser or API client.