queckezz / koa-views

Template rendering middleware for koa (hbs, swig, pug, anything! :sparkles:)
MIT License
710 stars 87 forks source link

Make render available on ctx.response #119

Closed rkt2spc closed 6 years ago

rkt2spc commented 6 years ago

Allow cleaner usage with koa:

exports.foo = async ({ request, response }, next) => {
    await response.render('foo/bar');
};
int64ago commented 6 years ago

Hi, why not use render from ctx directly, like this:

exports.foo = async ({ request, response, render }, next) => {
    await render('foo/bar');
};
rkt2spc commented 6 years ago

I think it's more intuitive this way. Imagine a lot of other APIs that have to be spread, the ctx object will be bloated.

int64ago commented 6 years ago

I will publish it with v6.1.4 later, thanks again!