Skip to content
Myr

Added 'settings' local variable, containing the app's settings

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 d11fa1f · Browse files · 2 files+14 added−5 removed
This commit

State

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

Diff stats

2 files+14 added−5 removed

  • other:+14 added−5 removed

2 files+14 added−5 removed

modified:docs/guide.md+11 added-5 removed
1128 unmodified lines
1129### app.helpers(obj)11301131Registers static view helpers.11321133 app.helpers({1134 name: function(first, last){ return first + ', ' + last }1135 , firstName: 'tj'1136 , lastName: 'holowaychuk'1137 });1133 app.helpers({1134 name: function(first, last){ return first + ', ' + last }1135 , firstName: 'tj'1136 , lastName: 'holowaychuk'1137 });11381139Our view could now utilize the _firstName_ and _lastName_ variables,1140as well as the _name()_ function exposed.11411142 <%= name(firstName, lastName) %>11431144Express also provides a few locals by default:11451146 - `settings` the app's settings object11471148This method is aliased as _app.locals()_.11491150### app.dynamicHelpers(obj)11511152Registers dynamic view helpers. Dynamic view helpers1153are simply functions which accept _req_, _res_, and are
82 unmodified lines
modified:lib/http.js+3 added
81 unmodified lines
82 this.__usedRouter = true;83 return fn;84 });8586 // default locals87 this.locals({ settings: this.settings });8889 // default development configuration90 this.configure('development', function(){91 this.enable('hints');92 });
375 unmodified lines