/* automatically generated by JSCoverage - do not edit */
if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
if (! _$jscoverage['application.js']) {
  _$jscoverage['application.js'] = [];
  _$jscoverage['application.js'][12] = 0;
  _$jscoverage['application.js'][29] = 0;
  _$jscoverage['application.js'][41] = 0;
  _$jscoverage['application.js'][42] = 0;
  _$jscoverage['application.js'][43] = 0;
  _$jscoverage['application.js'][44] = 0;
  _$jscoverage['application.js'][45] = 0;
  _$jscoverage['application.js'][46] = 0;
  _$jscoverage['application.js'][47] = 0;
  _$jscoverage['application.js'][50] = 0;
  _$jscoverage['application.js'][51] = 0;
  _$jscoverage['application.js'][52] = 0;
  _$jscoverage['application.js'][55] = 0;
  _$jscoverage['application.js'][56] = 0;
  _$jscoverage['application.js'][61] = 0;
  _$jscoverage['application.js'][62] = 0;
  _$jscoverage['application.js'][71] = 0;
  _$jscoverage['application.js'][72] = 0;
  _$jscoverage['application.js'][75] = 0;
  _$jscoverage['application.js'][76] = 0;
  _$jscoverage['application.js'][79] = 0;
  _$jscoverage['application.js'][80] = 0;
  _$jscoverage['application.js'][83] = 0;
  _$jscoverage['application.js'][84] = 0;
  _$jscoverage['application.js'][85] = 0;
  _$jscoverage['application.js'][89] = 0;
  _$jscoverage['application.js'][90] = 0;
  _$jscoverage['application.js'][91] = 0;
  _$jscoverage['application.js'][93] = 0;
  _$jscoverage['application.js'][94] = 0;
  _$jscoverage['application.js'][95] = 0;
  _$jscoverage['application.js'][98] = 0;
  _$jscoverage['application.js'][102] = 0;
  _$jscoverage['application.js'][103] = 0;
  _$jscoverage['application.js'][104] = 0;
  _$jscoverage['application.js'][105] = 0;
  _$jscoverage['application.js'][106] = 0;
  _$jscoverage['application.js'][107] = 0;
  _$jscoverage['application.js'][108] = 0;
  _$jscoverage['application.js'][112] = 0;
  _$jscoverage['application.js'][115] = 0;
  _$jscoverage['application.js'][116] = 0;
  _$jscoverage['application.js'][119] = 0;
  _$jscoverage['application.js'][120] = 0;
  _$jscoverage['application.js'][132] = 0;
  _$jscoverage['application.js'][133] = 0;
  _$jscoverage['application.js'][145] = 0;
  _$jscoverage['application.js'][146] = 0;
  _$jscoverage['application.js'][159] = 0;
  _$jscoverage['application.js'][160] = 0;
  _$jscoverage['application.js'][163] = 0;
  _$jscoverage['application.js'][166] = 0;
  _$jscoverage['application.js'][169] = 0;
  _$jscoverage['application.js'][170] = 0;
  _$jscoverage['application.js'][171] = 0;
  _$jscoverage['application.js'][172] = 0;
  _$jscoverage['application.js'][173] = 0;
  _$jscoverage['application.js'][174] = 0;
  _$jscoverage['application.js'][175] = 0;
  _$jscoverage['application.js'][180] = 0;
  _$jscoverage['application.js'][181] = 0;
  _$jscoverage['application.js'][184] = 0;
  _$jscoverage['application.js'][185] = 0;
  _$jscoverage['application.js'][186] = 0;
  _$jscoverage['application.js'][189] = 0;
  _$jscoverage['application.js'][209] = 0;
  _$jscoverage['application.js'][210] = 0;
  _$jscoverage['application.js'][211] = 0;
  _$jscoverage['application.js'][212] = 0;
  _$jscoverage['application.js'][274] = 0;
  _$jscoverage['application.js'][275] = 0;
  _$jscoverage['application.js'][279] = 0;
  _$jscoverage['application.js'][280] = 0;
  _$jscoverage['application.js'][281] = 0;
  _$jscoverage['application.js'][282] = 0;
  _$jscoverage['application.js'][286] = 0;
  _$jscoverage['application.js'][287] = 0;
  _$jscoverage['application.js'][290] = 0;
  _$jscoverage['application.js'][291] = 0;
  _$jscoverage['application.js'][292] = 0;
  _$jscoverage['application.js'][296] = 0;
  _$jscoverage['application.js'][309] = 0;
  _$jscoverage['application.js'][310] = 0;
  _$jscoverage['application.js'][311] = 0;
  _$jscoverage['application.js'][312] = 0;
  _$jscoverage['application.js'][313] = 0;
  _$jscoverage['application.js'][314] = 0;
  _$jscoverage['application.js'][317] = 0;
  _$jscoverage['application.js'][318] = 0;
  _$jscoverage['application.js'][331] = 0;
  _$jscoverage['application.js'][332] = 0;
  _$jscoverage['application.js'][345] = 0;
  _$jscoverage['application.js'][346] = 0;
  _$jscoverage['application.js'][357] = 0;
  _$jscoverage['application.js'][358] = 0;
  _$jscoverage['application.js'][369] = 0;
  _$jscoverage['application.js'][370] = 0;
  _$jscoverage['application.js'][381] = 0;
  _$jscoverage['application.js'][382] = 0;
  _$jscoverage['application.js'][411] = 0;
  _$jscoverage['application.js'][412] = 0;
  _$jscoverage['application.js'][414] = 0;
  _$jscoverage['application.js'][415] = 0;
  _$jscoverage['application.js'][416] = 0;
  _$jscoverage['application.js'][417] = 0;
  _$jscoverage['application.js'][430] = 0;
  _$jscoverage['application.js'][431] = 0;
  _$jscoverage['application.js'][432] = 0;
  _$jscoverage['application.js'][439] = 0;
  _$jscoverage['application.js'][440] = 0;
  _$jscoverage['application.js'][441] = 0;
  _$jscoverage['application.js'][442] = 0;
  _$jscoverage['application.js'][443] = 0;
  _$jscoverage['application.js'][444] = 0;
  _$jscoverage['application.js'][458] = 0;
  _$jscoverage['application.js'][459] = 0;
  _$jscoverage['application.js'][460] = 0;
  _$jscoverage['application.js'][461] = 0;
  _$jscoverage['application.js'][462] = 0;
  _$jscoverage['application.js'][464] = 0;
  _$jscoverage['application.js'][469] = 0;
  _$jscoverage['application.js'][482] = 0;
  _$jscoverage['application.js'][483] = 0;
  _$jscoverage['application.js'][490] = 0;
  _$jscoverage['application.js'][491] = 0;
  _$jscoverage['application.js'][495] = 0;
  _$jscoverage['application.js'][498] = 0;
  _$jscoverage['application.js'][501] = 0;
  _$jscoverage['application.js'][504] = 0;
  _$jscoverage['application.js'][509] = 0;
  _$jscoverage['application.js'][512] = 0;
  _$jscoverage['application.js'][513] = 0;
  _$jscoverage['application.js'][520] = 0;
  _$jscoverage['application.js'][524] = 0;
  _$jscoverage['application.js'][525] = 0;
  _$jscoverage['application.js'][527] = 0;
}
_$jscoverage['application.js'][12]++;
var connect = require("connect"), Router = require("./router"), methods = Router.methods.concat("del", "all"), middleware = require("./middleware"), debug = require("debug")("express:application"), View = require("./view"), url = require("url"), utils = connect.utils, path = require("path"), http = require("http"), join = path.join, fs = require("fs");
_$jscoverage['application.js'][29]++;
var app = exports = module.exports = {};
_$jscoverage['application.js'][41]++;
app.init = (function () {
  _$jscoverage['application.js'][42]++;
  var self = this;
  _$jscoverage['application.js'][43]++;
  this.cache = {};
  _$jscoverage['application.js'][44]++;
  this.settings = {};
  _$jscoverage['application.js'][45]++;
  this.engines = {};
  _$jscoverage['application.js'][46]++;
  this.viewCallbacks = [];
  _$jscoverage['application.js'][47]++;
  this.defaultConfiguration();
  _$jscoverage['application.js'][50]++;
  methods.forEach((function (method) {
  _$jscoverage['application.js'][51]++;
  self.lookup[method] = (function (path) {
  _$jscoverage['application.js'][52]++;
  return self._router.lookup(method, path);
});
  _$jscoverage['application.js'][55]++;
  self.remove[method] = (function (path) {
  _$jscoverage['application.js'][56]++;
  return self._router.lookup(method, path).remove();
});
}));
  _$jscoverage['application.js'][61]++;
  self.lookup.del = self.lookup["delete"];
  _$jscoverage['application.js'][62]++;
  self.remove.del = self.remove["delete"];
});
_$jscoverage['application.js'][71]++;
app.defaultConfiguration = (function () {
  _$jscoverage['application.js'][72]++;
  var self = this;
  _$jscoverage['application.js'][75]++;
  this.set("env", process.env.NODE_ENV || "development");
  _$jscoverage['application.js'][76]++;
  debug("booting in %s mode", this.get("env"));
  _$jscoverage['application.js'][79]++;
  this.use(connect.query());
  _$jscoverage['application.js'][80]++;
  this.use(middleware.init(this));
  _$jscoverage['application.js'][83]++;
  this.locals = (function (obj) {
  _$jscoverage['application.js'][84]++;
  for (var key in obj) {
    _$jscoverage['application.js'][84]++;
    self.locals[key] = obj[key];
}
  _$jscoverage['application.js'][85]++;
  return self;
});
  _$jscoverage['application.js'][89]++;
  this.locals.use = (function (fn) {
  _$jscoverage['application.js'][90]++;
  if (3 == fn.length) {
    _$jscoverage['application.js'][91]++;
    self.viewCallbacks.push(fn);
  }
  else {
    _$jscoverage['application.js'][93]++;
    self.viewCallbacks.push((function (req, res, done) {
  _$jscoverage['application.js'][94]++;
  fn(req, res);
  _$jscoverage['application.js'][95]++;
  done();
}));
  }
  _$jscoverage['application.js'][98]++;
  return this;
});
  _$jscoverage['application.js'][102]++;
  this._router = new Router(this);
  _$jscoverage['application.js'][103]++;
  this.routes = this._router.routes;
  _$jscoverage['application.js'][104]++;
  this.__defineGetter__("router", (function () {
  _$jscoverage['application.js'][105]++;
  this._usedRouter = true;
  _$jscoverage['application.js'][106]++;
  this._router.caseSensitive = this.enabled("case sensitive routing");
  _$jscoverage['application.js'][107]++;
  this._router.strict = this.enabled("strict routing");
  _$jscoverage['application.js'][108]++;
  return this._router.middleware;
}));
  _$jscoverage['application.js'][112]++;
  this.locals.settings = this.settings;
  _$jscoverage['application.js'][115]++;
  this.configure("development", (function () {
  _$jscoverage['application.js'][116]++;
  this.set("json spaces", 2);
}));
  _$jscoverage['application.js'][119]++;
  this.configure("production", (function () {
  _$jscoverage['application.js'][120]++;
  this.enable("view cache");
}));
});
_$jscoverage['application.js'][132]++;
app.remove = (function (path) {
  _$jscoverage['application.js'][133]++;
  return this._router.lookup("all", path).remove();
});
_$jscoverage['application.js'][145]++;
app.lookup = (function (path) {
  _$jscoverage['application.js'][146]++;
  return this._router.lookup("all", path);
});
_$jscoverage['application.js'][159]++;
app.use = (function (route, fn) {
  _$jscoverage['application.js'][160]++;
  var app, home, handle;
  _$jscoverage['application.js'][163]++;
  if ("string" != typeof route) {
    _$jscoverage['application.js'][163]++;
    fn = route, route = "/";
  }
  _$jscoverage['application.js'][166]++;
  if (fn.handle && fn.set) {
    _$jscoverage['application.js'][166]++;
    app = fn;
  }
  _$jscoverage['application.js'][169]++;
  if (app) {
    _$jscoverage['application.js'][170]++;
    app.route = route;
    _$jscoverage['application.js'][171]++;
    fn = (function (req, res, next) {
  _$jscoverage['application.js'][172]++;
  var orig = req.app;
  _$jscoverage['application.js'][173]++;
  app.handle(req, res, (function (err) {
  _$jscoverage['application.js'][174]++;
  req.app = res.app = orig;
  _$jscoverage['application.js'][175]++;
  next(err);
}));
});
  }
  _$jscoverage['application.js'][180]++;
  debug("use %s %s", route, fn.name || "unnamed");
  _$jscoverage['application.js'][181]++;
  connect.proto.use.call(this, route, fn);
  _$jscoverage['application.js'][184]++;
  if (app) {
    _$jscoverage['application.js'][185]++;
    app.parent = this;
    _$jscoverage['application.js'][186]++;
    app.emit("mount", this);
  }
  _$jscoverage['application.js'][189]++;
  return this;
});
_$jscoverage['application.js'][209]++;
app.engine = (function (ext, fn) {
  _$jscoverage['application.js'][210]++;
  if ("." != ext[0]) {
    _$jscoverage['application.js'][210]++;
    ext = "." + ext;
  }
  _$jscoverage['application.js'][211]++;
  this.engines[ext] = fn;
  _$jscoverage['application.js'][212]++;
  return this;
});
_$jscoverage['application.js'][274]++;
app.param = (function (name, fn) {
  _$jscoverage['application.js'][275]++;
  var self = this, fns = [].slice.call(arguments, 1);
  _$jscoverage['application.js'][279]++;
  if (Array.isArray(name)) {
    _$jscoverage['application.js'][280]++;
    name.forEach((function (name) {
  _$jscoverage['application.js'][281]++;
  fns.forEach((function (fn) {
  _$jscoverage['application.js'][282]++;
  self.param(name, fn);
}));
}));
  }
  else {
    _$jscoverage['application.js'][286]++;
    if ("function" == typeof name) {
      _$jscoverage['application.js'][287]++;
      this._router.param(name);
    }
    else {
      _$jscoverage['application.js'][290]++;
      if (":" == name[0]) {
        _$jscoverage['application.js'][290]++;
        name = name.substr(1);
      }
      _$jscoverage['application.js'][291]++;
      fns.forEach((function (fn) {
  _$jscoverage['application.js'][292]++;
  self._router.param(name, fn);
}));
    }
  }
  _$jscoverage['application.js'][296]++;
  return this;
});
_$jscoverage['application.js'][309]++;
app.set = (function (setting, val) {
  _$jscoverage['application.js'][310]++;
  if (1 == arguments.length) {
    _$jscoverage['application.js'][311]++;
    if (this.settings.hasOwnProperty(setting)) {
      _$jscoverage['application.js'][312]++;
      return this.settings[setting];
    }
    else {
      _$jscoverage['application.js'][313]++;
      if (this.parent) {
        _$jscoverage['application.js'][314]++;
        return this.parent.set(setting);
      }
    }
  }
  else {
    _$jscoverage['application.js'][317]++;
    this.settings[setting] = val;
    _$jscoverage['application.js'][318]++;
    return this;
  }
});
_$jscoverage['application.js'][331]++;
app.path = (function () {
  _$jscoverage['application.js'][332]++;
  return this.parent? this.parent.path() + this.route: "";
});
_$jscoverage['application.js'][345]++;
app.enabled = (function (setting) {
  _$jscoverage['application.js'][346]++;
  return ! ! this.set(setting);
});
_$jscoverage['application.js'][357]++;
app.disabled = (function (setting) {
  _$jscoverage['application.js'][358]++;
  return ! this.set(setting);
});
_$jscoverage['application.js'][369]++;
app.enable = (function (setting) {
  _$jscoverage['application.js'][370]++;
  return this.set(setting, true);
});
_$jscoverage['application.js'][381]++;
app.disable = (function (setting) {
  _$jscoverage['application.js'][382]++;
  return this.set(setting, false);
});
_$jscoverage['application.js'][411]++;
app.configure = (function (env, fn) {
  _$jscoverage['application.js'][412]++;
  var envs = "all", args = [].slice.call(arguments);
  _$jscoverage['application.js'][414]++;
  fn = args.pop();
  _$jscoverage['application.js'][415]++;
  if (args.length) {
    _$jscoverage['application.js'][415]++;
    envs = args;
  }
  _$jscoverage['application.js'][416]++;
  if ("all" == envs || ~ envs.indexOf(this.settings.env)) {
    _$jscoverage['application.js'][416]++;
    fn.call(this);
  }
  _$jscoverage['application.js'][417]++;
  return this;
});
_$jscoverage['application.js'][430]++;
app.listen = (function () {
  _$jscoverage['application.js'][431]++;
  var server = http.createServer(this);
  _$jscoverage['application.js'][432]++;
  return server.listen.apply(server, arguments);
});
_$jscoverage['application.js'][439]++;
methods.forEach((function (method) {
  _$jscoverage['application.js'][440]++;
  app[method] = (function (path) {
  _$jscoverage['application.js'][441]++;
  if ("get" == method && 1 == arguments.length) {
    _$jscoverage['application.js'][441]++;
    return this.set(path);
  }
  _$jscoverage['application.js'][442]++;
  var args = [method].concat([].slice.call(arguments));
  _$jscoverage['application.js'][443]++;
  if (! this._usedRouter) {
    _$jscoverage['application.js'][443]++;
    this.use(this.router);
  }
  _$jscoverage['application.js'][444]++;
  return this._router.route.apply(this._router, args);
});
}));
_$jscoverage['application.js'][458]++;
app.all = (function (path) {
  _$jscoverage['application.js'][459]++;
  var args = arguments;
  _$jscoverage['application.js'][460]++;
  methods.forEach((function (method) {
  _$jscoverage['application.js'][461]++;
  if ("all" == method || "del" == method) {
    _$jscoverage['application.js'][461]++;
    return;
  }
  _$jscoverage['application.js'][462]++;
  app[method].apply(this, args);
}), this);
  _$jscoverage['application.js'][464]++;
  return this;
});
_$jscoverage['application.js'][469]++;
app.del = app["delete"];
_$jscoverage['application.js'][482]++;
app.render = (function (name, options, fn) {
  _$jscoverage['application.js'][483]++;
  var self = this, opts = {}, cache = this.cache, engines = this.engines, view;
  _$jscoverage['application.js'][490]++;
  if ("function" == typeof options) {
    _$jscoverage['application.js'][491]++;
    fn = options, options = {};
  }
  _$jscoverage['application.js'][495]++;
  utils.merge(opts, this.locals);
  _$jscoverage['application.js'][498]++;
  if (options.locals) {
    _$jscoverage['application.js'][498]++;
    utils.merge(opts, options.locals);
  }
  _$jscoverage['application.js'][501]++;
  utils.merge(opts, options);
  _$jscoverage['application.js'][504]++;
  opts.cache = null == opts.cache? this.enabled("view cache"): opts.cache;
  _$jscoverage['application.js'][509]++;
  if (opts.cache) {
    _$jscoverage['application.js'][509]++;
    view = cache[name];
  }
  _$jscoverage['application.js'][512]++;
  if (! view) {
    _$jscoverage['application.js'][513]++;
    view = new View(name, {defaultEngine: this.get("view engine"), root: this.get("views") || process.cwd() + "/views", engines: engines});
    _$jscoverage['application.js'][520]++;
    if (opts.cache) {
      _$jscoverage['application.js'][520]++;
      cache[name] = view;
    }
  }
  _$jscoverage['application.js'][524]++;
  try {
    _$jscoverage['application.js'][525]++;
    view.render(opts, fn);
  }
  catch (err) {
    _$jscoverage['application.js'][527]++;
    fn(err);
  }
});
_$jscoverage['application.js'].source = ["","/*!"," * Express - proto"," * Copyright(c) 2010 TJ Holowaychuk &lt;tj@vision-media.ca&gt;"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var connect = require('connect')","  , Router = require('./router')","  , methods = Router.methods.concat('del', 'all')","  , middleware = require('./middleware')","  , debug = require('debug')('express:application')","  , View = require('./view')","  , url = require('url')","  , utils = connect.utils","  , path = require('path')","  , http = require('http')","  , join = path.join","  , fs = require('fs');","","/**"," * Application prototype."," */","","var app = exports = module.exports = {};","","/**"," * Initialize the server."," *"," *   - setup default configuration"," *   - setup default middleware"," *   - setup route reflection methods"," *"," * @api private"," */","","app.init = function(){","  var self = this;","  this.cache = {};","  this.settings = {};","  this.engines = {};","  this.viewCallbacks = [];","  this.defaultConfiguration();","","  // route reflection methods","  methods.forEach(function(method){","    self.lookup[method] = function(path){","      return self._router.lookup(method, path);","    };","","    self.remove[method] = function(path){","      return self._router.lookup(method, path).remove();","    };","  });","","  // del -&gt; delete","  self.lookup.del = self.lookup.delete;","  self.remove.del = self.remove.delete;","};","","/**"," * Initialize application configuration."," *"," * @api private"," */","","app.defaultConfiguration = function(){","  var self = this;","","  // default settings","  this.set('env', process.env.NODE_ENV || 'development');","  debug('booting in %s mode', this.get('env'));","","  // implicit middleware","  this.use(connect.query());","  this.use(middleware.init(this));","","  // app locals","  this.locals = function(obj){","    for (var key in obj) self.locals[key] = obj[key];","    return self;","  };","","  // response locals","  this.locals.use = function(fn){","    if (3 == fn.length) {","      self.viewCallbacks.push(fn);","    } else {","      self.viewCallbacks.push(function(req, res, done){","        fn(req, res);","        done();","      });","    }","    return this;","  };","","  // router","  this._router = new Router(this);","  this.routes = this._router.routes;","  this.__defineGetter__('router', function(){","    this._usedRouter = true;","    this._router.caseSensitive = this.enabled('case sensitive routing');","    this._router.strict = this.enabled('strict routing');","    return this._router.middleware;","  });","","  // default locals","  this.locals.settings = this.settings;","","  // default configuration","  this.configure('development', function(){","    this.set('json spaces', 2);","  });","","  this.configure('production', function(){","    this.enable('view cache');","  });","};","","/**"," * Remove routes matching the given `path`."," *"," * @param {Route} path"," * @return {Boolean}"," * @api public"," */","","app.remove = function(path){","  return this._router.lookup('all', path).remove();","};","","/**"," * Lookup routes defined with a path"," * equivalent to `path`."," *"," * @param {String} path"," * @return {Array}"," * @api public"," */","","app.lookup = function(path){","  return this._router.lookup('all', path);","};","","/**"," * Proxy `connect#use()` to apply settings to"," * mounted applications."," *"," * @param {String|Function|Server} route"," * @param {Function|Server} fn"," * @return {app} for chaining"," * @api public"," */","","app.use = function(route, fn){","  var app, home, handle;","","  // default route to '/'","  if ('string' != typeof route) fn = route, route = '/';","","  // express app","  if (fn.handle &amp;&amp; fn.set) app = fn;","","  // restore .app property on req and res","  if (app) {","    app.route = route;","    fn = function(req, res, next) {","      var orig = req.app;","      app.handle(req, res, function(err){","        req.app = res.app = orig;","        next(err);","      });","    };","  }","","  debug('use %s %s', route, fn.name || 'unnamed');","  connect.proto.use.call(this, route, fn);","","  // mounted an app","  if (app) {","    app.parent = this;","    app.emit('mount', this);","  }","","  return this;","};","","/**"," * Register the given template engine callback `fn`"," * as `ext`. For example we may wish to map \".html\""," * files to ejs rather than using the \".ejs\" extension."," *"," *    app.engine('.html', require('ejs').render);"," *"," * or"," *"," *    app.engine('html', require('ejs').render);"," *"," * @param {String} ext"," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.engine = function(ext, fn){","  if ('.' != ext[0]) ext = '.' + ext;","  this.engines[ext] = fn;","  return this;","};","","/**"," * Map the given param placeholder `name`(s) to the given callback(s)."," *"," * Param mapping is used to provide pre-conditions to routes"," * which us normalized placeholders. This callback has the same"," * signature as regular middleware, for example below when \":userId\""," * is used this function will be invoked in an attempt to load the user."," *"," *      app.param('userId', function(req, res, next, id){"," *        User.find(id, function(err, user){"," *          if (err) {"," *            next(err);"," *          } else if (user) {"," *            req.user = user;"," *            next();"," *          } else {"," *            next(new Error('failed to load user'));"," *          }"," *        });"," *      });"," *"," * Passing a single function allows you to map logic"," * to the values passed to `app.param()`, for example"," * this is useful to provide coercion support in a concise manner."," *"," * The following example maps regular expressions to param values"," * ensuring that they match, otherwise passing control to the next"," * route:"," *"," *      app.param(function(name, regexp){"," *        if (regexp instanceof RegExp) {"," *          return function(req, res, next, val){"," *            var captures;"," *            if (captures = regexp.exec(String(val))) {"," *              req.params[name] = captures;"," *              next();"," *            } else {"," *              next('route');"," *            }"," *          }"," *        }"," *      });"," *"," * We can now use it as shown below, where \"/commit/:commit\" expects"," * that the value for \":commit\" is at 5 or more digits. The capture"," * groups are then available as `req.params.commit` as we defined"," * in the function above."," *"," *    app.param('commit', /^\\d{5,}$/);"," *"," * For more of this useful functionality take a look"," * at [express-params](http://github.com/visionmedia/express-params)."," *"," * @param {String|Array|Function} name"," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.param = function(name, fn){","  var self = this","    , fns = [].slice.call(arguments, 1);","","  // array","  if (Array.isArray(name)) {","    name.forEach(function(name){","      fns.forEach(function(fn){","        self.param(name, fn);","      });","    });","  // param logic","  } else if ('function' == typeof name) {","    this._router.param(name);","  // single","  } else {","    if (':' == name[0]) name = name.substr(1);","    fns.forEach(function(fn){","      self._router.param(name, fn);","    });","  }","","  return this;","};","","/**"," * Assign `setting` to `val`, or return `setting`'s value."," * Mounted servers inherit their parent server's settings."," *"," * @param {String} setting"," * @param {String} val"," * @return {Server|Mixed} for chaining, or the setting value"," * @api public"," */","","app.set = function(setting, val){","  if (1 == arguments.length) {","    if (this.settings.hasOwnProperty(setting)) {","      return this.settings[setting];","    } else if (this.parent) {","      return this.parent.set(setting);","    }","  } else {","    this.settings[setting] = val;","    return this;","  }","};","","/**"," * Return the app's absolute pathname"," * based on the parent(s) that have"," * mounted it."," *"," * @return {String}"," * @api private"," */","","app.path = function(){","  return this.parent","    ? this.parent.path() + this.route","    : '';","};","","/**"," * Check if `setting` is enabled."," *"," * @param {String} setting"," * @return {Boolean}"," * @api public"," */","","app.enabled = function(setting){","  return !!this.set(setting);","};","","/**"," * Check if `setting` is disabled."," *"," * @param {String} setting"," * @return {Boolean}"," * @api public"," */","","app.disabled = function(setting){","  return !this.set(setting);","};","","/**"," * Enable `setting`."," *"," * @param {String} setting"," * @return {app} for chaining"," * @api public"," */","","app.enable = function(setting){","  return this.set(setting, true);","};","","/**"," * Disable `setting`."," *"," * @param {String} setting"," * @return {app} for chaining"," * @api public"," */","","app.disable = function(setting){","  return this.set(setting, false);","};","","/**"," * Configure callback for zero or more envs,"," * when no env is specified that callback will"," * be invoked for all environments. Any combination"," * can be used multiple times, in any order desired."," *"," * Examples:"," *"," *    app.configure(function(){"," *      // executed for all envs"," *    });"," *"," *    app.configure('stage', function(){"," *      // executed staging env"," *    });"," *"," *    app.configure('stage', 'production', function(){"," *      // executed for stage and production"," *    });"," *"," * @param {String} env..."," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.configure = function(env, fn){","  var envs = 'all'","    , args = [].slice.call(arguments);","  fn = args.pop();","  if (args.length) envs = args;","  if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);","  return this;","};","","/**"," * Listen for connections."," *"," * This method takes the same arguments"," * as node's `http.Server#listen()`.  "," *"," * @return {http.Server}"," * @api public"," */","","app.listen = function(){","  var server = http.createServer(this);","  return server.listen.apply(server, arguments);","};","","/**"," * Delegate `.VERB(...)` calls to `.route(VERB, ...)`."," */","","methods.forEach(function(method){","  app[method] = function(path){","    if ('get' == method &amp;&amp; 1 == arguments.length) return this.set(path); ","    var args = [method].concat([].slice.call(arguments));","    if (!this._usedRouter) this.use(this.router);","    return this._router.route.apply(this._router, args);","  }","});","","/**"," * Special-cased \"all\" method, applying the given route `path`,"," * middleware, and callback to _every_ HTTP method."," *"," * @param {String} path"," * @param {Function} ..."," * @return {app} for chaining"," * @api public"," */","","app.all = function(path){","  var args = arguments;","  methods.forEach(function(method){","    if ('all' == method || 'del' == method) return;","    app[method].apply(this, args);","  }, this);","  return this;","};","","// del -&gt; delete alias","","app.del = app.delete;","","/**"," * Render the given view `name` name with `options`"," * and a callback accepting an error and the"," * rendered template string."," *"," * @param {String} name"," * @param {String|Function} options or fn"," * @param {Function} fn"," * @api public"," */","","app.render = function(name, options, fn){","  var self = this","    , opts = {}","    , cache = this.cache","    , engines = this.engines","    , view;","","  // support callback function as second arg","  if ('function' == typeof options) {","    fn = options, options = {};","  }","","  // merge app.locals","  utils.merge(opts, this.locals);","","  // merge options.locals","  if (options.locals) utils.merge(opts, options.locals);","","  // merge options","  utils.merge(opts, options);","","  // set .cache unless explicitly provided","  opts.cache = null == opts.cache","    ? this.enabled('view cache')","    : opts.cache;","","  // primed cache","  if (opts.cache) view = cache[name];","","  // view","  if (!view) {","    view = new View(name, {","        defaultEngine: this.get('view engine')","      , root: this.get('views') || process.cwd() + '/views'","      , engines: engines","    });","","    // prime the cache","    if (opts.cache) cache[name] = view;","  }","","  // render","  try {","    view.render(opts, fn);","  } catch (err) {","    fn(err);","  }","};"];
