代码拉取完成,页面将自动刷新
let Renderer = require('engine/koa/renderer');
// (!) this.render does not assign this.body to the result
// that's because render can be used for different purposes, e.g to send emails
exports.init = function(app) {
app.use(async function(ctx, next) {
let renderer = new Renderer(ctx);
/**
* Render template
* Find the file:
* if locals.useAbsoluteTemplatePath => use templatePath
* else if templatePath starts with / => lookup in locals.basedir
* otherwise => lookup in ctx.templateDir (MW should set it)
* @param templatePath file to find (see the logic above)
* @param locals
* @returns {String}
*/
ctx.render = (templatePath, locals) => renderer.render(templatePath, locals);
await next();
});
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。