lib/kona/watch.js
function watchModules(paths) {

    paths || (paths = []);

    if (!Array.isArray(paths)) { paths = [paths]; }

    // for all directories / files in `config.watch` array
    paths.forEach(function(watchPath) {

      // watch modules for changes
      this.watch(watchPath, function(eventPath, stat) {

        // delete from the warm cache, the next require will be fresh
        var cached = require.cache[path.resolve(eventPath)];
        var children;

        if (!cached) return;

        cached.children.forEach(function(module) {
          delete require.cache[module.id]
        });
        delete require.cache[cached.parent.id];
        delete require.cache[path.resolve(eventPath)]

      });

    }.bind(this));
  }
function watchModules(paths) {

    paths || (paths = []);

    if (!Array.isArray(paths)) { paths = [paths]; }

    // for all directories / files in `config.watch` array
    paths.forEach(function(watchPath) {

      // watch modules for changes
      this.watch(watchPath, function(eventPath, stat) {

        // delete from the warm cache, the next require will be fresh
        var cached = require.cache[path.resolve(eventPath)];
        var children;

        if (!cached) return;

        cached.children.forEach(function(module) {
          delete require.cache[module.id]
        });
        delete require.cache[cached.parent.id];
        delete require.cache[path.resolve(eventPath)]

      });

    }.bind(this));
  }
function watchModules ( paths ) { paths || ( paths = [ ] ) ; if ( ! Array . isArray ( paths ) ) { paths = [ paths ] ; } // for all directories / files in `config.watch` array paths . forEach ( function ( watchPath ) { // watch modules for changes this . watch ( watchPath , function ( eventPath , stat ) { // delete from the warm cache, the next require will be fresh var cached = require . cache [ path . resolve ( eventPath ) ] ; var children ; if ( ! cached ) return ; cached . children . forEach ( function ( module ) { delete require . cache [ module . id ] } ) ; delete require . cache [ cached . parent . id ] ; delete require . cache [ path . resolve ( eventPath ) ] } ) ; } . bind ( this ) ) ; }
watches routes, controllers, models for changes and clears require cache
for those objects to be reloaded or clears routes and reloads them
watches routes controllers models for changes and clears require cache for those objects to be reloaded or clears routes and reloads them