You can also use the dynamic assistant to transfer data to all views.
app.js
app.dynamicHelpers({
appSettings: function(req, res){
return {name:"My App", version:"0.1"};
}
});
Now in your views you can use it like this (I used ejs in this example, but it should work with jade or any other viewing mechanism):
view.ejs
<%= appSettings.name %>
<%= appSettings.version %>
Hope this helps.
source
share