Skip to content
Myr

application.js

This file

Path

lib/application.js

562 lines · 11.7 KiB · JavaScript

Last changed by

.parent testsTj Holowaychukbefore adoption5d593f2

History of this file

Take it

The walk stopped after 200 commits: lines older than d1ce4c9 point at it.

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 1–14why, one step back
1
2/*!3 * Express - proto4 * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>5 * MIT Licensed6 */78/**9 * Module dependencies.10 */1112var connect = require('connect')13 , Router = require('./router')14 , methods = Router.methods.concat('del', 'all')

refactored init middleware into its own fileTj Holowaychukbefore adoption4c316ba

line 15why, one step back
15 , middleware = require('./middleware')

new ViewTj Holowaychukbefore adoptione1da383

line 16why, one step back
16 , View = require('./view')

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 17–19why, one step back
17 , url = require('url')
18 , utils = connect.utils19 , path = require('path')

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 20why, one step back
20 , http = require('http')

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 21–33why, one step back
21 , join = path.join
22 , fs = require('fs')23 , qs = require('qs');2425/**26 * Expose `HTTPServer`.27 */2829var app = exports = module.exports = {};3031/**32 * Initialize the server.33 *

refactoring boot logicTj Holowaychukbefore adoption8848004

lines 34–37why, one step back
34 * - setup default configuration
35 * - setup default middleware36 * - setup route reflection methods37 *

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 38–40why, one step back
38 * @api private
39 */40

refactoring boot logicTj Holowaychukbefore adoption8848004

line 41why, one step back
41app.init = function(){

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 42why, one step back
42 var self = this;

app.lookup()Tj Holowaychukbefore adoption76b7d69

line 43why, one step back
43 this.cache = {};

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 44–47why, one step back
44 this.settings = {};
45 this.engines = {};46 this.redirects = {};47 this.isCallbacks = {};

app.locals.use(fn)Tj Holowaychukbefore adoption0f6ad43

line 48why, one step back
48 this.viewCallbacks = [];

refactoring boot logicTj Holowaychukbefore adoption8848004

line 49why, one step back
49 this.defaultConfiguration();

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 50why, one step back
50

miscTj Holowaychukbefore adoptiond4b08e9

line 51why, one step back
51 // route reflection methods

refactoring boot logicTj Holowaychukbefore adoption8848004

lines 52–53why, one step back
52 methods.forEach(function(method){
53 self.lookup[method] = function(path){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 54why, one step back
54 return self._router.lookup(method, path);

refactoring boot logicTj Holowaychukbefore adoption8848004

lines 55–57why, one step back
55 };
5657 self.match[method] = function(path){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 58why, one step back
58 return self._router.match(method, path);

refactoring boot logicTj Holowaychukbefore adoption8848004

lines 59–61why, one step back
59 };
6061 self.remove[method] = function(path){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 62why, one step back
62 return self._router.lookup(method, path).remove();

refactoring boot logicTj Holowaychukbefore adoption8848004

lines 63–80why, one step back
63 };
64 });6566 // del -> delete67 self.lookup.del = self.lookup.delete;68 self.match.del = self.match.delete;69 self.remove.del = self.remove.delete;70};7172/**73 * Initialize application configuration.74 *75 * @api private76 */7778app.defaultConfiguration = function(){79 var self = this;80

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 81why, one step back
81 // default settings

Fixed res.clearCookie(), default path to "root" settingTj Holowaychukbefore adoption0f2f3d4

line 82why, one step back
82 this.set('root', '/');

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 83–84why, one step back
83 this.set('env', process.env.NODE_ENV || 'development');
84

refactored init middleware into its own fileTj Holowaychukbefore adoption4c316ba

line 85why, one step back
85 // implicit middleware

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 86why, one step back
86 this.use(connect.query());

refactored init middleware into its own fileTj Holowaychukbefore adoption4c316ba

line 87why, one step back
87 this.use(middleware.init(this));

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 88why, one step back
88

docsTj Holowaychukbefore adoption6ae32fd

line 89why, one step back
89 // app locals

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 90why, one step back
90 this.locals = function(obj){

misc refactoringTj Holowaychukbefore adoption4ed92d5

line 91why, one step back
91 for (var key in obj) self.locals[key] = obj[key];

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 92why, one step back
92 return self;

app.locals.use(fn)Tj Holowaychukbefore adoption0f6ad43

lines 93–94why, one step back
93 };
94

docsTj Holowaychukbefore adoption6ae32fd

line 95why, one step back
95 // response locals

app.locals.use(fn)Tj Holowaychukbefore adoption0f6ad43

line 96why, one step back
96 this.locals.use = function(fn){

added sync signature for app.locals.use()Tj Holowaychukbefore adoption965e1d6

lines 97–104why, one step back
97 if (3 == fn.length) {
98 self.viewCallbacks.push(fn);99 } else {100 self.viewCallbacks.push(function(req, res, done){101 fn(req, res);102 done();103 });104 }

app.locals.use(fn)Tj Holowaychukbefore adoption0f6ad43

line 105why, one step back
105 return this;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 106–108why, one step back
106 };
107108 // router

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

lines 109–110why, one step back
109 this._router = new Router(this);
110 this.routes = this._router.routes;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 111why, one step back
111 this.__defineGetter__('router', function(){

fixed auto use(app.router)Tj Holowaychukbefore adoption92c5284

line 112why, one step back
112 this._usedRouter = true;

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 113why, one step back
113 return self._router.middleware;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 114–133why, one step back
114 });
115116 // default locals117 this.locals.settings = this.settings;118119 // default production configuration120 this.configure('production', function(){121 this.enable('view cache');122 });123};124125/**126 * Remove routes matching the given `path`.127 *128 * @param {Route} path129 * @return {Boolean}130 * @api public131 */132133app.remove = function(path){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 134why, one step back
134 return this._router.lookup('all', path).remove();

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 135–146why, one step back
135};
136137/**138 * Lookup routes defined with a path139 * equivalent to `path`.140 *141 * @param {Stirng} path142 * @return {Array}143 * @api public144 */145146app.lookup = function(path){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 147why, one step back
147 return this._router.lookup('all', path);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 148–158why, one step back
148};
149150/**151 * Lookup routes matching the given `url`.152 *153 * @param {Stirng} url154 * @return {Array}155 * @api public156 */157158app.match = function(url){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 159why, one step back
159 return this._router.match('all', url);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 160–162why, one step back
160};
161162/**

docsTj Holowaychukbefore adoption2e22887

line 163why, one step back
163 * Proxy `connect#use()` to apply settings to

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 164–166why, one step back
164 * mounted applications.
165 *166 * @param {String|Function|Server} route

misc refactoringTj Holowaychukbefore adoption1334a74

line 167why, one step back
167 * @param {Function|Server} fn

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 168why, one step back
168 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 169–171why, one step back
169 * @api public
170 */171

misc refactoringTj Holowaychukbefore adoption1334a74

line 172why, one step back
172app.use = function(route, fn){

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 173–174why, one step back
173 var app, home, handle;
174

misc refactoringTj Holowaychukbefore adoption1334a74

line 175why, one step back
175 if ('string' != typeof route) fn = route, route = '/';

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 176–177why, one step back
176
177 // express app

misc refactoringTj Holowaychukbefore adoption1334a74

line 178why, one step back
178 if (fn.handle && fn.set) app = fn;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 179–182why, one step back
179
180 // restore .app property on req and res181 if (app) {182 app.route = route;

misc refactoringTj Holowaychukbefore adoption1334a74

line 183why, one step back
183 fn = function(req, res, next) {

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 184–191why, one step back
184 var orig = req.app;
185 app.handle(req, res, function(err){186 req.app = res.app = orig;187 next(err);188 });189 };190 }191

misc refactoringTj Holowaychukbefore adoption1334a74

line 192why, one step back
192 connect.proto.use.call(this, route, fn);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 193why, one step back
193

.parent testsTj Holowaychukbefore adoption5d593f2

line 194why, one step back
194 // mounted an app, emit "mount"

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 195–196why, one step back
195 // and adjust some settings
196 if (app) {

tweak res.redirect() mount route logicTj Holowaychukbefore adoption43d9f6e

lines 197–200why, one step back
197 var root = this.get('root') || this.route;
198 if ('/' == root) root = '';199 root = root + (app.get('root') || app.route);200 app.set('root', root);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 201why, one step back
201 app.parent = this;

Added: emit "mount" event on the app being mountedTj Holowaychukbefore adoptionb6611c8

line 202why, one step back
202 app.emit('mount', this);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 203–212why, one step back
203 }
204205 return this;206};207208/**209 * Register the given template engine callback `fn`210 * as `ext`. For example we may wish to map ".html"211 * files to ejs rather than using the ".ejs" extension.212 *

Added app.engine() testsTj Holowaychukbefore adoption66f8ca5

line 213why, one step back
213 * app.engine('.html', require('ejs').render);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 214–216why, one step back
214 *
215 * or216 *

Added app.engine() testsTj Holowaychukbefore adoption66f8ca5

line 217why, one step back
217 * app.engine('html', require('ejs').render);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 218–220why, one step back
218 *
219 * @param {String} ext220 * @param {Function} fn

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 221why, one step back
221 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 222–224why, one step back
222 * @api public
223 */224

Added app.engine() testsTj Holowaychukbefore adoption66f8ca5

line 225why, one step back
225app.engine = function(ext, fn){

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 226–285why, one step back
226 if ('.' != ext[0]) ext = '.' + ext;
227 this.engines[ext] = fn;228 return this;229};230231/**232 * Map the given param placeholder `name`(s) to the given callback(s).233 *234 * Param mapping is used to provide pre-conditions to routes235 * which us normalized placeholders. This callback has the same236 * signature as regular middleware, for example below when ":userId"237 * is used this function will be invoked in an attempt to load the user.238 *239 * app.param('userId', function(req, res, next, id){240 * User.find(id, function(err, user){241 * if (err) {242 * next(err);243 * } else if (user) {244 * req.user = user;245 * next();246 * } else {247 * next(new Error('failed to load user'));248 * }249 * });250 * });251 *252 * Passing a single function allows you to map logic253 * to the values passed to `app.param()`, for example254 * this is useful to provide coercion support in a concise manner.255 *256 * The following example maps regular expressions to param values257 * ensuring that they match, otherwise passing control to the next258 * route:259 *260 * app.param(function(name, regexp){261 * if (regexp instanceof RegExp) {262 * return function(req, res, next, val){263 * var captures;264 * if (captures = regexp.exec(String(val))) {265 * req.params[name] = captures;266 * next();267 * } else {268 * next('route');269 * }270 * }271 * }272 * });273 *274 * We can now use it as shown below, where "/commit/:commit" expects275 * that the value for ":commit" is at 5 or more digits. The capture276 * groups are then available as `req.params.commit` as we defined277 * in the function above.278 *279 * app.param('commit', /^\d{5,}$/);280 *281 * For more of this useful functionality take a look282 * at [express-params](http://github.com/visionmedia/express-params).283 *284 * @param {String|Array|Function} name285 * @param {Function} fn

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 286why, one step back
286 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 287–302why, one step back
287 * @api public
288 */289290app.param = function(name, fn){291 var self = this292 , fns = [].slice.call(arguments, 1);293294 // array295 if (Array.isArray(name)) {296 name.forEach(function(name){297 fns.forEach(function(fn){298 self.param(name, fn);299 });300 });301 // param logic302 } else if ('function' == typeof name) {

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 303why, one step back
303 this._router.param(name);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 304–307why, one step back
304 // single
305 } else {306 if (':' == name[0]) name = name.substr(1);307 fns.forEach(function(fn){

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 308why, one step back
308 self._router.param(name, fn);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 309–319why, one step back
309 });
310 }311312 return this;313};314315/**316 * Register the given callback `fn` for the given `type`.317 *318 * @param {String} type319 * @param {Function} fn

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 320why, one step back
320 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 321–380why, one step back
321 * @api public
322 */323324app.is = function(type, fn){325 if (!fn) return this.isCallbacks[type];326 this.isCallbacks[type] = fn;327 return this;328};329330/**331 * Assign `setting` to `val`, or return `setting`'s value.332 * Mounted servers inherit their parent server's settings.333 *334 * @param {String} setting335 * @param {String} val336 * @return {Server|Mixed} for chaining, or the setting value337 * @api public338 */339340app.set = function(setting, val){341 if (val === undefined) {342 if (this.settings.hasOwnProperty(setting)) {343 return this.settings[setting];344 } else if (this.parent) {345 return this.parent.set(setting);346 }347 } else {348 this.settings[setting] = val;349 return this;350 }351};352353/**354 * Check if `setting` is enabled.355 *356 * @param {String} setting357 * @return {Boolean}358 * @api public359 */360361app.enabled = function(setting){362 return !!this.set(setting);363};364365/**366 * Check if `setting` is disabled.367 *368 * @param {String} setting369 * @return {Boolean}370 * @api public371 */372373app.disabled = function(setting){374 return !this.set(setting);375};376377/**378 * Enable `setting`.379 *380 * @param {String} setting

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 381why, one step back
381 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 382–392why, one step back
382 * @api public
383 */384385app.enable = function(setting){386 return this.set(setting, true);387};388389/**390 * Disable `setting`.391 *392 * @param {String} setting

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 393why, one step back
393 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 394–405why, one step back
394 * @api public
395 */396397app.disable = function(setting){398 return this.set(setting, false);399};400401/**402 * Redirect `key` to `url`.403 *404 * @param {String} key405 * @param {String} url

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 406why, one step back
406 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 407–436why, one step back
407 * @api public
408 */409410app.redirect = function(key, url){411 this.redirects[key] = url;412 return this;413};414415/**416 * Configure callback for zero or more envs,417 * when no env is specified that callback will418 * be invoked for all environments. Any combination419 * can be used multiple times, in any order desired.420 *421 * Examples:422 *423 * app.configure(function(){424 * // executed for all envs425 * });426 *427 * app.configure('stage', function(){428 * // executed staging env429 * });430 *431 * app.configure('stage', 'production', function(){432 * // executed for stage and production433 * });434 *435 * @param {String} env...436 * @param {Function} fn

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 437why, one step back
437 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 438–442why, one step back
438 * @api public
439 */440441app.configure = function(env, fn){442 var envs = 'all'

Removed toArray() utilTj Holowaychukbefore adoption7a7d77e

line 443why, one step back
443 , args = [].slice.call(arguments);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 444–450why, one step back
444 fn = args.pop();
445 if (args.length) envs = args;446 if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);447 return this;448};449450/**

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

lines 451–465why, one step back
451 * Listen for connections.
452 *453 * This method takes the same arguments454 * as node's `http.Server#listen()`. 455 *456 * @return {http.Server}457 * @api public458 */459460app.listen = function(){461 var server = http.createServer(this);462 return server.listen.apply(server, arguments);463};464465/**

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 466–470why, one step back
466 * Delegate `.VERB(...)` calls to `.route(VERB, ...)`.
467 */468469methods.forEach(function(method){470 app[method] = function(path){

Added `app.get(setting)`. Closes #842Tj Holowaychukbefore adoptione0bd0d6

line 471why, one step back
471 if ('get' == method && 1 == arguments.length) return this.set(path);

Removed toArray() utilTj Holowaychukbefore adoption7a7d77e

line 472why, one step back
472 var args = [method].concat([].slice.call(arguments));

fixed auto use(app.router)Tj Holowaychukbefore adoption92c5284

line 473why, one step back
473 if (!this._usedRouter) this.use(this.router);

Added `app.routes`, replacing `app.routes.all()`. Closes #811Tj Holowaychukbefore adoption62257bc

line 474why, one step back
474 return this._router._route.apply(this._router, args);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 475–483why, one step back
475 }
476});477478/**479 * Special-cased "all" method, applying the given route `path`,480 * middleware, and callback to _every_ HTTP method.481 *482 * @param {String} path483 * @param {Function} ...

Added app.listen() as a shortcut for http.createServer(app).listen()Tj Holowaychukbefore adoption9082e74

line 484why, one step back
484 * @return {app} for chaining

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 485–501why, one step back
485 * @api public
486 */487488app.all = function(path){489 var args = arguments;490 methods.forEach(function(method){491 if ('all' == method) return;492 app[method].apply(this, args);493 }, this);494 return this;495};496497// del -> delete alias498499app.del = app.delete;500501/**

new ViewTj Holowaychukbefore adoptione1da383

line 502why, one step back
502 * Render the given view `name` name with `options`

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 503–505why, one step back
503 * and a callback accepting an error and the
504 * rendered template string.505 *

new ViewTj Holowaychukbefore adoptione1da383

line 506why, one step back
506 * @param {String} name

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 507–511why, one step back
507 * @param {String|Function} options or fn
508 * @param {Function} fn509 * @api public510 */511

new ViewTj Holowaychukbefore adoptione1da383

line 512why, one step back
512app.render = function(name, options, fn){

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 513–514why, one step back
513 var self = this
514 , opts = {}

re-implemented "view cache"Tj Holowaychukbefore adoption8a38211

line 515why, one step back
515 , cache = this.cache

new ViewTj Holowaychukbefore adoptione1da383

lines 516–517why, one step back
516 , engines = this.engines
517 , view;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 518–535why, one step back
518
519 // support callback function as second arg520 if ('function' == typeof options) {521 fn = options, options = {};522 }523524 // merge app.locals525 utils.merge(opts, this.locals);526527 // merge options.locals528 if (options.locals) {529 utils.merge(opts, options.locals);530 delete opts.locals;531 }532533 // merge options534 utils.merge(opts, options);535

new ViewTj Holowaychukbefore adoptione1da383

lines 536–539why, one step back
536 // set .cache unless explicitly provided
537 opts.cache = null == opts.cache538 ? this.enabled('view cache')539 : opts.cache;

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 540why, one step back
540

new ViewTj Holowaychukbefore adoptione1da383

lines 541–542why, one step back
541 // primed cache
542 if (opts.cache) view = cache[name];

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 543why, one step back
543

new ViewTj Holowaychukbefore adoptione1da383

lines 544–546why, one step back
544 // view
545 if (!view) {546 view = new View(name, {

Fixed app.render() absolute path supportTj Holowaychukbefore adoptionb9dee73

lines 547–548why, one step back
547 defaultEngine: this.get('view engine')
548 , root: this.get('views') || process.cwd() + '/views'

new ViewTj Holowaychukbefore adoptione1da383

lines 549–550why, one step back
549 , engines: engines
550 });

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

line 551why, one step back
551

new ViewTj Holowaychukbefore adoptione1da383

lines 552–555why, one step back
552 // prime the cache
553 if (opts.cache) cache[name] = view;554 }555

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 556–557why, one step back
556 // render
557 try {

new ViewTj Holowaychukbefore adoptione1da383

line 558why, one step back
558 view.render(opts, fn);

req.query is always presentTj Holowaychukbefore adoptiond1ce4c9

lines 559–562why, one step back
559 } catch (err) {
560 fn(err);561 }562};