koa-views-render

Simple render(page, locals) middleware for Koa and Lad (uses koa-views)

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
koa-views-render
500.0.15 years ago5 years agoMinified + gzip package size for koa-views-render in KB

Readme

koa-views-render
code style styled with prettier made with lass license
Simple render(page, locals) middleware for Koa and Lad (uses koa-views).

Table of Contents

Install

npm install @ladjs/koa-views-render
yarn add @ladjs/koa-views-render

Usage

This is a simple middleware that simply passes down to ctx.render the page and locals arguments you provide.
For example render(page,locals) will get passed to ctx.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' });

Contributors

| Name | Website | | -------------- | -------------------------- | | Nick Baugh | |

License

MIT © Nick Baugh