Skip to content

sixwinds/xtpl4koa2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

xtpl4koa2

A temp polyfill of xtpl for koa2. This my personl plugin. Offcial update please watch https://github.com/xtemplate/xtpl

Installation:

npm install --save koa xtemplate xtpl

Usage:

Please refer to repo/example

var Koa = require( 'koa' );
var xtpl = require( '../src/koa2' ); // You can copy koa2.js to your own project and require it according to your project dir structure.
var path = require( 'path' );

// -------------------------- main -------------------------------
var app = new Koa();

xtpl( app,{
    views: path.resolve( __dirname, 'views' )
} );

app.use( async function(ctx){
  await ctx.render( 'index', {
    name: 'Bernie'
  } )
} );

app.listen(80);

About

A temp polyfill of xtpl for koa2

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published