I am testing GraphQL Server from Apollo and what to integrate nodemon to it. Here's sample file structure :
build/
src/
server.js
Here my npm scripts looks like this
"scripts": {
"start": "babel --presets es2015,stage-2 server.js -d build/ && node build/server.js",
"dev": "nodemon server.js" // Sample code here
}
What npm run start
would do is to convert ES6 code into build/server.js
using babel and execute it. This would start the server correctly.
What I want is to watch for changes in server.js
or in src/
and restart the server if changes occur. Here I want to execute npm run start
command if any changes occur. What is the correct 'nodemon' command to my need. Its better if I could use npm run dev
like command to start development using nodemon.