Simple
render(page, locals)
middleware for Koa and Lad (uses koa-views).
npm:
npm install koa-views-render
yarn:
yarn add koa-views-render
This is a simple middleware that simply passes down to
ctx.render
thepage
andlocals
arguments you provide.For example
render(page,locals)
will get passed toctx.render(page,locals)
. See koa-views for full reference.
const render = require('koa-views-render');
// ...
app.use(render('home'));
With optional
locals
object argument:
app.use(render('about', { title: 'About Us' });
Name | Website |
---|---|
Nick Baugh | http://niftylettuce.com/ |