awdry
v0.2.0
Published
Auto controller-view rendering
Downloads
7
Maintainers
Readme
Awdry
Automatically find views to render from a controller action. Built on Sodor
npm install awdry
Usage
Given a templater quite like Brio that takes a dotted path to a template and a hash of template variables, attaches a render method to controller action with an appropriate path.
var extend = require('estira').extend;
var Controller = require('awdry');
var brio = require('brio');
var templates = brio((t) => (d) => t, {
account: {
index: 'hello world'
}
});
var Account = extend.call(Controller, 'Account', {
index: function() {
return this.render();
}
});
Account.handle('index', [])({}); //⇒ 'hello world'
Licence
MIT. © 2014 Matt Brennan.