{"_id":"koa-connect","_rev":"12-e72a4e48a82d4e4d864942cfb33f4915","name":"koa-connect","dist-tags":{"latest":"2.1.1"},"versions":{"1.0.0":{"name":"koa-connect","version":"1.0.0","author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"license":"MIT","_id":"koa-connect@1.0.0","maintainers":[{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"dist":{"shasum":"0aecf10df15f32526ad15815115cb3d40aece705","tarball":"https://registry.npmjs.org/koa-connect/-/koa-connect-1.0.0.tgz","integrity":"sha512-NQ7H8gBh90LLi8Fq0i+gdS9ELYiu7Yplytsdh9xVYdKhjpcU82DOIq7h3recWHhQVwP1RWCAgJ76EVeMRe9RTw==","signatures":[{"sig":"MEUCIQClLFGwFmhX6TOQhADUqM9xjWjEaPxmtGPL+hzAnuzJ4gIgC9Tj0S0kytdeutNKbVFOgvIJMYxr9e59Rm+uU08t6TQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"0aecf10df15f32526ad15815115cb3d40aece705","_npmUser":{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"},"_npmVersion":"1.4.9","description":"Use connect and express middleware in koa","directories":{},"respository":"vkurchatkin/koa-connect","dependencies":{"connect":"^2.25.7"},"devDependencies":{"koa":"^0.10.0"}},"2.0.0":{"name":"koa-connect","version":"2.0.0","keywords":["koa","connect","express","middleware"],"author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"license":"MIT","_id":"koa-connect@2.0.0","maintainers":[{"name":"lourd","email":"louis@grovelabs.io"},{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"contributors":[{"name":"Louis DeScioli","email":"louis.descioli@gmail.com"}],"homepage":"https://github.com/vkurchatkin/koa-connect#readme","bugs":{"url":"https://github.com/vkurchatkin/koa-connect/issues"},"dist":{"shasum":"b69da158fe5df04a59f5fce57b147343f6ff652e","tarball":"https://registry.npmjs.org/koa-connect/-/koa-connect-2.0.0.tgz","integrity":"sha512-QO0hw6zwBdQ7LCs+IOor/R6RSR+Q2TtRhosJV7vCvfNmLtr19z8ysmAGpre6TkdcWF4p6ksIBky7wwVsBjxYTA==","signatures":[{"sig":"MEQCIAx3IJezvsRL/jqzJS7Lmp/26JECmLFb6tUibJWdWpMPAiBO9IZwu/nDreyxxMpxeKZDi7hKoa/FxUcbLnXfKyoD9w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","_shasum":"b69da158fe5df04a59f5fce57b147343f6ff652e","gitHead":"43e59d484a311fa3ecb4dce5f4c8edf487ecd5f9","scripts":{"test":"mocha tests.js","test:watch":"npm run test -- --watch --reporter nyan"},"_npmUser":{"name":"lourd","email":"louis@grovelabs.io"},"repository":{"url":"git+https://github.com/vkurchatkin/koa-connect.git","type":"git"},"_npmVersion":"4.0.5","description":"Use Connect/Express middleware in Koa","directories":{},"_nodeVersion":"7.4.0","devDependencies":{"koa":"^2.0.0","mocha":"^2.3.4","supertest":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/koa-connect-2.0.0.tgz_1484238134410_0.5455546798184514","host":"packages-12-west.internal.npmjs.com"}},"2.0.1":{"name":"koa-connect","version":"2.0.1","keywords":["koa","connect","express","middleware"],"author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"license":"MIT","_id":"koa-connect@2.0.1","maintainers":[{"name":"lourd","email":"louis@grovelabs.io"},{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"contributors":[{"url":"https://descioli.design","name":"Louis DeScioli"}],"homepage":"https://github.com/vkurchatkin/koa-connect#readme","bugs":{"url":"https://github.com/vkurchatkin/koa-connect/issues"},"dist":{"shasum":"2acad159c33862de1d73aa4562a48de13f137c0f","tarball":"https://registry.npmjs.org/koa-connect/-/koa-connect-2.0.1.tgz","fileCount":11,"integrity":"sha512-MNaiK5og8aj4I+tx8l+jSW24QX7aaQyZemV821VPY+AOJ8XUbrrAj9AzrpZKDQp5jTmylAZW2sXhTz2+SRqZog==","signatures":[{"sig":"MEUCIQDXxrX/faZHtUY3rD8ky9AdNUhOQWTPJ/M0E5fv5lACnwIgSvkv7tP5ATlnERgSbHbADN0VCmHF9btUt+pj40GdZXM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":24979},"main":"index.js","gitHead":"3956c5f694839d00064ab9c5ad876ccc6cd268fb","scripts":{"test":"mocha tests.js","test:watch":"npm run test -- --watch --reporter nyan"},"_npmUser":{"name":"lourd","email":"louis.descioli@gmail.com"},"repository":{"url":"git+https://github.com/vkurchatkin/koa-connect.git","type":"git"},"_npmVersion":"5.5.1","description":"Use Connect/Express middleware in Koa","directories":{},"_nodeVersion":"8.9.0","_hasShrinkwrap":false,"devDependencies":{"koa":"^2.0.0","mocha":"^2.3.4","supertest":"^1.1.0"},"_npmOperationalInternal":{"tmp":"tmp/koa-connect_2.0.1_1518626171470_0.7200071970310564","host":"s3://npm-registry-packages"}},"2.1.0":{"name":"koa-connect","version":"2.1.0","keywords":["koa","connect","express","middleware"],"author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"license":"MIT","_id":"koa-connect@2.1.0","maintainers":[{"name":"lourd","email":"louis@grovelabs.io"},{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"contributors":[{"url":"https://descioli.design","name":"Louis DeScioli"}],"homepage":"https://github.com/vkurchatkin/koa-connect#readme","bugs":{"url":"https://github.com/vkurchatkin/koa-connect/issues"},"dist":{"shasum":"16bce0a917c4cb24233aaac83fbc5b83804b4a1c","tarball":"https://registry.npmjs.org/koa-connect/-/koa-connect-2.1.0.tgz","fileCount":16,"integrity":"sha512-O9pcFafHk0oQsBevlbTBlB9co+2RUQJ4zCzu3qJPmGlGoeEZkne+7gWDkecqDPSbCtED6LmhlQladxs6NjOnMQ==","signatures":[{"sig":"MEQCIGms1faepESFwgh/yEIQgxX9COD7/jlRHLw5cMh4keggAiBlJj4FjvJW5tf5r5H0aZ++7LGPUUr4YM4PHqhtc6X5qQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":17075,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe9lGqCRA9TVsSAnZWagAA3fUP+QGkMBgBjPv7oLtkwkPS\nVq+LdC78uo5DaaRAc++Y+yjIg33+n7FJp9P46IpvlzMcPkZEpmX1TN4UN5b/\nqIJGR76JpzG0xCThSoophPb5h/O9AH/QNwshQTkHAv8tKawSH7UhUs81fU+w\n+hWvIMZaK2mM3pg4jW6dTXs467IZxYN04HsVa4w2Tc4e8tGD9FDJN6kxTom4\nfaSf8AmgcA540kUMeaEf3UHtxRYfwCNatOSw2b3rrnMpUptj+HUIp94i03ZS\naud9EL4bUd0Oio+8j6nKsYneMG9rwOKbeq4NuXl6eFHZYWuiERtWaBmYftVd\n2AnmYFt4bxrDk2+1pUTjVCSCMAzJSNjd/OCzYSqWQFOHSZnrHpKqcNvMgo0l\nXC8yJ5mMOwWcUpAhXK5ckqGPnfGRyIbJ1hYBZEzL89P/Vv9m8lClQ9HJIB5L\nhC1j2dNwBGYOXXaMl9czlH/+f/b4ggmlRm/sJfCp+nmkrTeZwUUsuaaGyr//\nSQIfJnGdY6ANhtEZSNQlaToPW7gxmhNZtlflyyG4H16qLzEsBk0zpbQ1MRxe\nu7fvoMm4nLpoD4VyUrGC5CLEDkQ+feF+oxxvdN0bAE6pf5ZnDih8j+4P6OoC\ndFFO4vqWJQ4CtzwA8r1YSO4BdvNvT2d4ZZyVYSLHQpy1Ra2acEMbzVXj169v\n64DS\r\n=ALP0\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","husky":{"hooks":{"pre-commit":"lint-staged"}},"types":"index.d.ts","gitHead":"3f7c4020604895f6693c622fd0b48b377005f5da","scripts":{"test":"mocha -r ts-node/register tests.ts","build":"tsc -p tsconfig-build.json","start":"tsc --watch","test:watch":"npm run test -- --watch --watch-extensions ts --reporter nyan"},"_npmUser":{"name":"lourd","email":"louis.descioli@gmail.com"},"repository":{"url":"git+https://github.com/vkurchatkin/koa-connect.git","type":"git"},"_npmVersion":"6.13.7","description":"Use Connect/Express middleware in Koa","directories":{},"lint-staged":{"*.md":"prettier --write","!(*.d).ts":"prettier --single-quote --write"},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"devDependencies":{"koa":"^2.0.0","husky":"^4.2.5","mocha":"^2.3.4","ts-node":"^8.10.2","prettier":"^2.0.5","supertest":"^1.1.0","@types/koa":"^2.0.46","typescript":"^3.0.1","@types/node":"^10.9.2","body-parser":"^1.19.0","lint-staged":"^10.2.9","@types/mocha":"^7.0.2","@types/supertest":"^2.0.9","@types/body-parser":"^1.19.0"},"_npmOperationalInternal":{"tmp":"tmp/koa-connect_2.1.0_1593201066165_0.13624625029081217","host":"s3://npm-registry-packages"}},"2.1.1":{"name":"koa-connect","version":"2.1.1","description":"Use Connect/Express middleware in Koa","repository":{"type":"git","url":"git+https://github.com/vkurchatkin/koa-connect.git"},"main":"index.js","types":"index.d.ts","author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"contributors":[{"name":"Louis DeScioli","url":"https://descioli.design"}],"license":"MIT","scripts":{"start":"tsc --watch","build":"tsc -p tsconfig-build.json","test":"mocha -r ts-node/register tests.ts","test:watch":"npm run test -- --watch --watch-extensions ts --reporter nyan"},"devDependencies":{"@types/body-parser":"^1.19.0","@types/koa":"^2.0.46","@types/mocha":"^7.0.2","@types/node":"^10.9.2","@types/supertest":"^2.0.9","body-parser":"^1.19.0","husky":"^4.2.5","koa":"^2.0.0","lint-staged":"^10.2.9","mocha":"^2.3.4","prettier":"^2.0.5","supertest":"^1.1.0","ts-node":"^8.10.2","typescript":"^3.0.1"},"keywords":["koa","connect","express","middleware"],"husky":{"hooks":{"pre-commit":"lint-staged"}},"lint-staged":{"!(*.d).ts":"prettier --single-quote --write","*.md":"prettier --write"},"gitHead":"fc06368f954dfcff64de9e03776a8fa6d0d33cf5","_id":"koa-connect@2.1.1","bugs":{"url":"https://github.com/vkurchatkin/koa-connect/issues"},"homepage":"https://github.com/vkurchatkin/koa-connect#readme","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-ejvbGKYS6di4LUSS+6E+Z5ZVev9RqThLm3NfZjb9QHZMASLvnr4eDTImKcGlQXFrtVpMTyTovZ+Hcl6JbBuFNA==","shasum":"1e7c7a32e7b689dd4da6617ed5112ee259b0ced4","tarball":"https://registry.npmjs.org/koa-connect/-/koa-connect-2.1.1.tgz","fileCount":14,"unpackedSize":10556,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCeRilqA6P7d1GzZs1ltHVKO4k2byOLtk1NgjAuqJ8N5AIgY5PXldGphIwKKTG3I217hBBTRFlgcQ2mQ0MBF8twt6s="}]},"_npmUser":{"name":"lourd","email":"louis.descioli@gmail.com"},"directories":{},"maintainers":[{"name":"lourd","email":"louis.descioli@gmail.com"},{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/koa-connect_2.1.1_1770731223075_0.33210896887920716"},"_hasShrinkwrap":false}},"time":{"created":"2014-08-19T16:02:19.354Z","modified":"2026-02-10T13:47:03.603Z","1.0.0":"2014-08-19T16:02:19.354Z","2.0.0":"2017-01-12T16:22:16.334Z","2.0.1":"2018-02-14T16:36:12.268Z","2.1.0":"2020-06-26T19:51:06.374Z","2.1.1":"2026-02-10T13:47:03.470Z"},"bugs":{"url":"https://github.com/vkurchatkin/koa-connect/issues"},"author":{"name":"Vladimir Kurchatkin","email":"vladimir.kurchatkin@gmail.com"},"license":"MIT","homepage":"https://github.com/vkurchatkin/koa-connect#readme","keywords":["koa","connect","express","middleware"],"repository":{"type":"git","url":"git+https://github.com/vkurchatkin/koa-connect.git"},"description":"Use Connect/Express middleware in Koa","contributors":[{"name":"Louis DeScioli","url":"https://descioli.design"}],"maintainers":[{"name":"lourd","email":"louis.descioli@gmail.com"},{"name":"vkurchatkin","email":"vladimir.kurchatkin@gmail.com"}],"readme":"# koa-connect [![npm package badge][npm badge]][npm]\n\n[npm badge]: https://badge.fury.io/js/koa-connect.svg\n[npm]: https://www.npmjs.com/package/koa-connect\n\nUse [Express](https://github.com/strongloop/express)/[Connect](https://github.com/senchalabs/connect) middleware with [Koa](https://github.com/koajs/koa).\n\n## Warning\n\nIt is **highly** recommended to use a Koa-specific middleware instead of trying to convert an Express version when they're available. There is a non-trivial difference in the Koa and Express designs and you will inevitably run into some issues. This module is a workaround for the specific cases where the differences can be ignored. Additionally, it also enables library authors to write 1 version of their HTTP middleware.\n\n### Always use `next` middleware parameter\n\nExpress middlewares need to declare and invoke the `next` callback appropriately for the koa-connect integration to work correctly.\n\n### For library authors\n\nIf you're attempting to write a framework-agnostic middleware library, be sure to use only core HTTP methods and not any Express-dependent APIs like `res.send`.\n\n## Installation\n\n```sh\nnpm install koa-connect\n```\n\n## Usage\n\nSee [`examples/`](./examples) for more practical usage.\n\n```javascript\nconst Koa = require('koa');\nconst c2k = require('koa-connect');\n\n// A generic Express-style middleware function\nfunction connectMiddlware(req, res, next) {\n  res.writeHead(200, { 'Content-Type': 'text/plain' });\n  res.end('From the Connect middleware');\n  next();\n}\n\n// A generic Koa middlware, without async/await\nfunction koaMiddlware(ctx, next) {\n  next()\n    .then(() => {\n      // The control flow will bubble back to here, like usual\n    })\n    .catch((err) => {\n      // Error handling from downstream middleware, like usual\n    });\n}\n\n// A generic Koa middlware with async/await\nasync function koaMiddleware(ctx, next) {\n  try {\n    await next();\n  } catch (e) {\n    // Normal error handling\n  }\n  // Normal control flow\n}\n\nconst app = new Koa();\napp.use(koaMiddlware);\napp.use(c2k(connectMiddlware));\napp.use((ctx, next) => {\n  console.log('It will continue on to here');\n});\n\napp.listen(3000);\n```\n\n## Contributing\n\n### Developing\n\n`npm start` starts the TypeScript compiler in watch mode. Code will be auto-formatted upon commit as part of the Prettier + lint-staged + Husky setup.\n\n### Building\n\n`npm run build` produces the types declaration file and JavaScript file for publishing.\n\n### Testing\n\n`npm test` runs the tests. Tests are in `tests.js` and are made with the [Mocha](https://mochajs.org) framework.\n\nUse `npm run test:watch` in conjunction with `npm start` to automatically re-run the tests when the source changes.\n\n## License\n\nMIT\n","readmeFilename":"README.md","users":{"shanewholloway":true}}