Express.js Guide: The Comprehensive Book on Express.js (2014)
Watching for File Changes
This topic is little bit outside of Express.js, but we thought it so important that it’s worth mentioning. Node.js applications are stored in memory, and if we make changes to the source code, we need to restart the process, i.e., node.
There are brilliant tools that can leverage watch method from the core Node.js fs module and restart our servers when we save changes from an editor:
· supervisor (GitHub)
· up (GitHub)
· node-dev (GitHub)
· nodemon (GitHub)
|
|
Tip It’s good to know that Express.js reloads a template file for every new request by default. So, no server restart is necessary. However, we can cache templates by enabling the view cache setting, which we’ll cover at length later in the book. |
All materials on the site are licensed Creative Commons Attribution-Sharealike 3.0 Unported CC BY-SA 3.0 & GNU Free Documentation License (GFDL)
If you are the copyright holder of any material contained on our site and intend to remove it, please contact our site administrator for approval.
© 2016-2025 All site design rights belong to S.Y.A.
