{"id":18468,"library":"koa-cors","title":"koa-cors","description":"CORS middleware for Koa (v0.0.16). Inspired by node-cors, this middleware adds Cross-Origin Resource Sharing (CORS) headers to Koa responses. It supports all standard CORS options: origin, expose, maxAge, credentials, methods, and headers. It is a simple, lightweight solution for enabling CORS in Koa apps, but note that the package is old and the Koa ecosystem has evolved significantly since v1. Unmaintained since 2016; consider using @koa/cors for modern Koa 2.x.","status":"deprecated","version":"0.0.16","language":"javascript","source_language":"en","source_url":"https://github.com/evert0n/koa-cors","tags":["javascript","cors","koa","koajs"],"install":[{"cmd":"npm install koa-cors","lang":"bash","label":"npm"},{"cmd":"yarn add koa-cors","lang":"bash","label":"yarn"},{"cmd":"pnpm add koa-cors","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is CJS-only and has no default or named exports.","symbol":"default","correct":"const cors = require('koa-cors');"}],"quickstart":{"code":"const Koa = require('koa');\nconst cors = require('koa-cors');\nconst app = new Koa();\napp.use(cors({ origin: true }));\napp.use(async ctx => { ctx.body = 'Hello World'; });\napp.listen(3000);","lang":"javascript","description":"Shows basic Koa app with CORS enabled reflecting request origin."},"warnings":[{"fix":"Use @koa/cors instead, which supports Koa 2.x.","message":"koa-cors is designed for Koa v1 (generator-based middleware). Koa v2 uses async/await and may have compatibility issues.","severity":"gotcha","affected_versions":"0.0.0-0.0.16"},{"fix":"Migrate to active alternatives like @koa/cors or koa2-cors.","message":"Package unmaintained since 2016. No updates for compatibility with modern Node.js.","severity":"gotcha","affected_versions":"0.0.0-0.0.16"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use @koa/cors or wrap with koa-convert: const convert = require('koa-convert'); app.use(convert(cors()));","cause":"Koa v2 uses async functions, but koa-cors expects a generator (Koa v1).","error":"TypeError: app.use() requires a generator function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}