Skip to content
Myr

use app.engines instead of app.cache

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Tj Holowaychuk · committed by Tj Holowaychuk · parent a9396ef · Browse files · 1 file+2 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−3 removed

  • other:+2 added−3 removed

1 file+2 added−3 removed

modified:lib/application.js+2 added-3 removed
37 unmodified lines
38 */3940app.init = function(middleware){41 var self = this;42 this.cache = {};42 this.settings = {};43 this.engines = {};44 this.redirects = {};45 this.isCallbacks = {};
512 unmodified lines
558559app.render = function(view, opts, fn){560 var self = this561 , options = {}563 , cache = this.cache562 , engines = this.engines563 , root = this.set('views') || process.cwd() + '/views';564565 // support callback function as second arg
18 unmodified lines
584 if (!ext) return fn(new Error('failed to find view "' + view + '"'));585586 // render587 try {588 console.log(engines);590 var engine = cache[ext] = cache[ext] || require(ext);589 var engine = engines[ext] = engines[ext] || require(ext);590 options.filename = join(root, view);591 view = fs.readFileSync(options.filename, 'utf8');592 engine.render(view, options, fn);593 } catch (err) {
3 unmodified lines