InversifyJS icon indicating copy to clipboard operation
InversifyJS copied to clipboard

[Feature] Official support for koa

Open lonix1 opened this issue 6 years ago • 3 comments

inversify officially supports and has examples for express, restify and hapi.

What about koa? It was discussed some years ago but never pursued.

Some background:

  • koa was created by the same team as express
  • all express' core devs moved to koa
  • koa is actively maintained and improved
  • express is based on a decade-old design; koa is modern
  • TJ himself recommends koa (his poor documentation comment is no longer valid)
  • express is abandonware - the next version has been "in development" for half a decade... in truth it is in maintenance mode
  • koa avoids callback hell by using async/await, so async work is now EASY and fun
  • it is heavily used - about 300k downloads per week on npm
  • ecosystem is big, there is a middleware for everything
  • the only learning curve (which you can cover in 5 minutes) is that the middleware is a proper stack (unlike express), which means we can have pre- and post-hooks like in .NET and Java (think of actionfilters, global handlers, etc.!)
  • koa would be very familiar to .NET devs - I know inversify was designed to be as close as possible to ASP.NET Core... this would make it possible to add even more modern goodies

Suggestion:

  • there is an unofficial inversify-koa-utils, based on inversify-express-utils
  • it does exactly what we are used to, but for koa
  • the codebase is surprisingly small and neat
  • it could be used as the basis for an official inversify-koa plugin

It looks like it's 99% of the way there, as it's a 1:1 copy of inversify-express-utils. If inversify's core devs do a code review on it, we could have good koa support very quickly. And I hereby volunteer as guinea pig # 1.

(cc. @remojansen)

lonix1 avatar Apr 05 '19 08:04 lonix1

+1

chenqing avatar Feb 06 '22 13:02 chenqing

if people will maintain it, I don't see a reason why not to add it. We don't even have time to do much for inversify itself. moving the burden of maintaining yet another package is not a good idea.

PodaruDragos avatar Feb 06 '22 14:02 PodaruDragos

+1

ZQ-jhon avatar Apr 29 '24 08:04 ZQ-jhon