Keeping Services Running with nodemon
Especially during development, itâs useful to have your Node.js application automatically restart when files change on disk. We saw a similar technique work well when running tests using Mocha back in âEnabling Continuous Testing with Mochaâ.
Short for Node Monitor, nodemon runs a Node.js program and then automatically restarts it whenever the source code changes or if the process terminates. To use it, first we have to install and save the dependency.
â | â$ âânpmââ ââinstallââ ââ--saveââ ââ--save-exactââ âânodemon@1.11.0â |
Next, open your package.json file and add a new start command to the scripts section to override the default.
â | â"scripts"â: { |
â |
Get Node.js 8 the Right Way now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.