Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including koa-views-render with all npm packages installed. Try it out:

var koaViewsRender = require("koa-views-render")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

koa-views-render v0.0.1

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

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:

npm install @ladjs/koa-views-render

yarn:

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

NameWebsite
Nick Baughhttp://niftylettuce.com/

License

MIT © Nick Baugh

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free