siren-views
1.0.0 • Public • Published siren-views
Template rendering middleware for koa, modified from koa-views:
- instead of
ctx.locals
, we use ctx.state
to store template context.
return yield *next
if ctx.render
exists (no matter what the type is).
Example
var koa = require('koa');
var views = require('siren-views');
var app = koa();
app.use(views('views', {
default: 'jade',
map: {
html: underscore
}
}));
app.use(function* (next) {
this.state.session = this.session;
this.state.title = 'app';
yield this.render('user', {
user: 'John'
});
});
API
Please refer to koa-views.
Tests
Tests use mocha and can be run
with npm:
npm test
License
MIT
Versions
Current Tags
- VersionDownloads (Last 7 Days)
- 1.0.0
2
Version History
- VersionDownloads (Last 7 Days)
- 1.0.0
2
Package Sidebar
Install
Weekly Downloads