diff --git a/README.md b/README.md index 87038d8..77f961a 100644 --- a/README.md +++ b/README.md @@ -162,6 +162,17 @@ app.use(function*(){ }); ``` +### use for koa2 + +```javascript +var app = require('xtpl/lib/koa')(require('koa')(),{ + views:'./views' +}); +app.use( async (ctx, next){ +    ctx.body = await ctx.render('test',{data: 1});   //需要把渲染完的字符串传给body +}); +``` + ## Example ├── footer.xtpl @@ -238,4 +249,4 @@ https://github.com/xtemplate/xtpl/milestones ## License -xtpl is released under the MIT license. \ No newline at end of file +xtpl is released under the MIT license.