The new version 18 for Node.js comes with a watch mode, so you might not need nodemon.
You can enable that using the –watch flag to watch the entry point and any imported module. To be more granular, –watch-path allows you to specify a particular directory that should react to changes.
These flags cannot be combined with –check, –eval, –interactive, or when used in REPL known as read–eval–print loop mode.
node --watch index.js
// or use the path to the folder of index.js
node --watch-path=./src --watch-path=./tests index.js