queckezz / koa-views

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

support app.context, not need middleware #141

Closed EdwardZZZ closed 4 years ago

EdwardZZZ commented 4 years ago

support app.context, not need middleware

int64ago commented 4 years ago

Hi, thanks for the PR, could you please explain why we need this feature, thanks again.

EdwardZZZ commented 4 years ago

Hi,The current 'koa-views' only supports the extension of the middleware form, the middleware form has a requirement on the order, but there is no requirement on the order through the extension of the app.context, and the extension form is more flexible.

int64ago commented 4 years ago

the middleware form has a requirement on the order, but there is no requirement on the order through the extension of the app.context

It's the problem(or feature) of Koa, maybe it's not a good idea to handle this case in this way.

We are restrained to add a new feature, for removing a feature is hard.

EdwardZZZ commented 4 years ago

Actually, for the expansion of the context, Koa made clear suggestions:

https://github.com/koajs/koa/blob/6b6b0ddf7aff073e65493c6efaffab8331c0331c/docs/api/index.md#appcontext

int64ago commented 4 years ago

Ok, thanks for the explanation, would you please do:

EdwardZZZ commented 4 years ago

OK

int64ago commented 4 years ago

Thanks, i'll release a minor version later :-)

int64ago commented 4 years ago

Released via v6.3.0