Skip to content
Myr

added app.register()

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 60353c6 · Browse files · 1 file+15 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+15 added−3 removed

  • other:+15 added−3 removed

1 file+15 added−3 removed

modified:lib/application.js+15 added-3 removed
39 unmodified lines
40app.init = function(middleware){41 var self = this;42 this.cache = {};43 this.settings = {};44 this.engines = {};45 this.redirects = {};46 this.isCallbacks = {};4748 this.set('home', '/');
203 unmodified lines
252 return this;253};254255/**255 * See: view.register.256 * Register the given template engine callback `fn`257 * as `ext`. For example we may wish to map ".html"258 * files to ejs rather than using the ".ejs" extension.259 *260 * app.register('.html', require('ejs').render);261 *262 * or263 *264 * app.register('html', require('ejs').render);265 *266 * @param {String} ext267 * @param {Function} fn268 * @return {Server} for chaining269 * @api public270 */271261app.register = function(){262 view.register.apply(this, arguments);272app.register = function(ext, fn){273 if ('.' != ext[0]) ext = '.' + ext;274 this.engines[ext] = fn;275 return this;276};277278/**
319 unmodified lines