# Auto-Restart with nodemon — Node.js Fundamentals: Modules, Async and Servers

Source: https://www.skillbyai.com/en/nodejs/node-nodemon

> Restart your server on every file change with nodemon or Node's built-in --watch flag.

## Installing & running

`nodemon` watches your files and restarts Node on every save — great during development.

```bash
npm install -D nodemon
npx nodemon server.js
```

## Node's own --watch flag

Since Node 18, `node --watch server.js` does the same thing natively — no package needed for simple cases.

**Quiz:** What is the main benefit of nodemon (or node --watch) during development?

- [ ] It makes the app run faster in production
- [ ] It replaces the need for testing
- [ ] It bundles your code for production
- [x] It restarts the server automatically on file changes

*Answer:* It restarts the server automatically on file changes. It removes the manual stop-and-restart cycle every time you edit code.
