awdry

Auto controller-view rendering

Usage no npm install needed!

<script type="module">
  import awdry from 'https://cdn.skypack.dev/awdry';
</script>

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.