koa-convert is a utility package designed to bridge compatibility gaps between major versions of the Koa.js web framework. It primarily converts legacy Koa 0.x and 1.x generator-based middleware into modern Koa 2.x promise-based middleware. Conversely, it can also convert modern promise middleware back to legacy generator format, which is useful for enabling newer middleware to run on older Koa 0.x or 1.x applications. The current stable version is 2.0.0, released in 2017. As such, the package is no longer actively developed, and its release cadence has ceased. Its key differentiator is its ability to facilitate incremental migration for existing Koa applications, allowing mixed middleware patterns to coexist. While still functional for its specific purpose, its overall utility for new projects has significantly diminished as Koa 2.x has been the standard for many years.
npm install koa-convertVerified import paths — ran on the pinned version, not inferred.
Demonstrates converting individual legacy middleware, and a global override of `app.use` to automatically convert all legacy middleware for easier migration in a Koa 2.x application.
Use Koa 2.x compatible versions of router libraries (e.g., koa-router@next, koa-route@3.0.0) directly, instead of attempting to convert older router middleware with `koa-convert`.
For new Koa projects, use modern promise-based middleware exclusively. Only consider `koa-convert` if you have a legacy Koa 0.x/1.x codebase that needs to integrate with Koa 2.x middleware, or vice-versa, without a full rewrite.
Ensure your project's Node.js environment meets the minimum requirement of Node.js >= 10. Upgrade Node.js if necessary.
Wrap the legacy generator middleware with `convert()`: `app.use(convert(legacyMiddleware))`.
Wrap the modern promise middleware with `convert.back()`: `app.use(convert.back(modernMiddleware))`.
No dependency data recorded yet.