{"library":"koa2-cors","type":"library","category":null,"description":"koa2-cors is a Koa 2.x middleware for handling Cross-Origin Resource Sharing (CORS) headers. It simplifies the implementation of CORS policies in Koa applications, allowing developers to configure the `Access-Control-Allow-Origin`, `Access-Control-Expose-Headers`, `Access-Control-Max-Age`, `Access-Control-Allow-Credentials`, `Access-Control-Allow-Methods`, and `Access-Control-Allow-Headers` through a straightforward options object or a dynamic function for the origin. The current stable version is 2.0.6. The package has seen sporadic updates, with recent releases focusing on compatibility (e.g., removing Babel in v2.0.5) and ensuring correct header behavior (v2.0.6 always sets `Vary: Origin`). It requires Node.js v7.6.0 or higher. Its key differentiator is its direct integration and simplicity within the Koa 2.x ecosystem, providing a robust and easy-to-configure solution for common CORS requirements without over-complication.","language":"javascript","status":"active","version":"2.0.6","tags":["javascript","koa2","cors","middleware"],"last_verified":"Wed May 27","install":[{"cmd":"npm install koa2-cors","imports":["const cors = require('koa2-cors');","import cors from 'koa2-cors';"]},{"cmd":"yarn add koa2-cors","imports":[]},{"cmd":"pnpm add koa2-cors","imports":[]}],"homepage":null,"github":"https://github.com/zadzbw/koa2-cors","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/koa2-cors","openapi_spec":null,"status_page":null,"smithery":null,"compatibility":{"summary":{"python_range":"18–22","success_rate":0,"avg_install_s":null,"avg_import_s":null,"wheel_type":null},"url":"https://checklist.day/v1/registry/koa2-cors/compatibility"}}