middleware/static_server/static_server.js
function createStaticFileRegex() {

  var regex = '^\\/(',
    staticViews = this.views.static;

  // Get directories in public/
  var files = getStaticDirs.call(this);

  // Iterate over files and append to regex
  for (var path, dir, re, i=0; i < files.length; i++) {
    dir = files[i];
    path = dir.replace(this.regex.startOrEndSlash, '').replace(this.regex.regExpChars, '\\$1');
    if (i > 0) path = "|" + path;
    regex += path;
  }

  // Finalize & create regex
  regex += ')\\/?';

  if (regex == '^\\/()\\/?') {
    // No directories found in public/. Invalidate regex
    this.staticFileRegex = /^$/;
  } else {
    // Directories found in public/
    this.staticFileRegex = new RegExp(regex);
  }

}
function createStaticFileRegex() {

  var regex = '^\\/(',
    staticViews = this.views.static;

  // Get directories in public/
  var files = getStaticDirs.call(this);

  // Iterate over files and append to regex
  for (var path, dir, re, i=0; i < files.length; i++) {
    dir = files[i];
    path = dir.replace(this.regex.startOrEndSlash, '').replace(this.regex.regExpChars, '\\$1');
    if (i > 0) path = "|" + path;
    regex += path;
  }

  // Finalize & create regex
  regex += ')\\/?';

  if (regex == '^\\/()\\/?') {
    // No directories found in public/. Invalidate regex
    this.staticFileRegex = /^$/;
  } else {
    // Directories found in public/
    this.staticFileRegex = new RegExp(regex);
  }

}
function createStaticFileRegex ( ) { var regex = '^\\/(' , staticViews = this . views . static ; // Get directories in public/ var files = getStaticDirs . call ( this ) ; // Iterate over files and append to regex for ( var path , dir , re , i = 0 ; i < files . length ; i ++ ) { dir = files [ i ] ; path = dir . replace ( this . regex . startOrEndSlash , '' ) . replace ( this . regex . regExpChars , '\\$1' ) ; if ( i > 0 ) path = "|" + path ; regex += path ; } // Finalize & create regex regex += ')\\/?' ; if ( regex == '^\\/()\\/?' ) { // No directories found in public/. Invalidate regex this . staticFileRegex = / ^$ / ; } else { // Directories found in public/ this . staticFileRegex = new RegExp ( regex ) ; } }
Creates the static file regex

@private
Creates the static file regex