Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

关于templating.js #7

Closed
jinlarry opened this issue Feb 19, 2017 · 1 comment
Closed

关于templating.js #7

jinlarry opened this issue Feb 19, 2017 · 1 comment

Comments

@jinlarry
Copy link

你好廖老师
关于你的view-koa项目
不太明白为什么在templating.js中这样写

function templating(path, opts) { var env = createEnv(path, opts); return async (ctx, next) => { ctx.render = function (view, model) { ctx.response.body = env.render(view, Object.assign({}, ctx.state || {}, model || {})); ctx.response.type = 'text/html'; }; await next(); }; }

请问这段代码是怎么使controller里面的ctx添加render()函数的?

@michaelliao
Copy link
Owner

有问题去网站提问

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants