Skip to content
Myr

app.lookup()

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 7e9186d · Browse files · 1 file+8 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+8 added−3 removed

  • other:+8 added−3 removed

1 file+8 added−3 removed

modified:lib/application.js+8 added-3 removed
35 unmodified lines
36 */3738app.init = function(middleware){39 var self = this;40 this.cache = {};41 this.settings = {};42 this.engines = {};43 this.redirects = {};44 this.isCallbacks = {};
509 unmodified lines
554555app.render = function(view, options, fn){556 var self = this557 , opts = {}557 , engines = this.engines558 , root = this.set('views') || process.cwd() + '/views';558 , engines = this.engines;559560 // support callback function as second arg561 if ('function' == typeof options) {562 fn = options, options = {};
23 unmodified lines
586587 // render588 try {589 var engine = engines[ext] = engines[ext] || require(ext);590 opts.filename = join(root, view);590 opts.filename = this.lookup(view);591 view = fs.readFileSync(opts.filename, 'utf8');592 engine.render(view, opts, fn);593 } catch (err) {594 fn(err);595 }596};597598app.lookup = function(view){599 var root = this.set('views') || process.cwd() + '/views';600 return join(root, view);601};