在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:koa-modules/swig开源软件地址:https://github.com/koa-modules/swig开源编程语言:JavaScript 95.7%开源软件介绍:koa-swigKoa view render based on Swig, support tags, filters, and extensions. Usage
Install
Features
Examplevar koa = require('koa');
var render = require('koa-swig');
var app = koa();
app.context.render = render({
root: path.join(__dirname, 'views'),
autoescape: true,
cache: 'memory', // disable, set to false
ext: 'html',
locals: locals,
filters: filters,
tags: tags,
extensions: extensions
});
app.use(function *() {
yield this.render('index');
});
app.listen(2333); // koa v2.x
var co = require('co');
app.context.render = co.wrap(render({
// ...your setting
writeBody: false
}));
app.use(async ctx => ctx.body = await ctx.render('index')); Settings
Methods
Others
LicencesMIT |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论