A small utility (v1.0.2, last updated 2019) that adapts Connect/Express-style middleware (req, res, next) to work with Koa 2.x async middleware (ctx, next). Unlike koa-connect, koa2-connect is designed to better support streaming middleware like webpack-dev-middleware and webpack-hot-middleware. It is a stopgap for when Koa-native alternatives are unavailable; not recommended for new projects where Koa-native middleware exists.
npm install koa2-connectVerified import paths — ran on the pinned version, not inferred.
Wrap an Express-style middleware with c2k and use it in a Koa app.
Ensure your Express middleware invokes next() when done, or use a Koa-native alternative.
Install @types/koa2-connect if available, or declare module 'koa2-connect' { ... }.Consider migrating to native Koa middleware or using koa-connect as an alternative.
Use a Koa-native error handler or wrap errors manually using try/catch inside the Express middleware.
Ensure the middleware is compatible with Connect/Express and always calls next().
Use only raw Node.js http methods (res.writeHead, res.end) and avoid Express-specific functions like res.status.
Use dynamic import: const c2k = (await import('koa2-connect')).default;No dependency data recorded yet.