{"name":"egg-cors","version":"2.2.2","description":"cors plugin for egg","eggPlugin":{"name":"cors"},"repository":{"type":"git","url":"git+ssh://git@github.com/eggjs/egg-cors.git"},"keywords":["egg","eggPlugin","egg-plugin","cors"],"dependencies":{"@koa/cors":"^3.0.0"},"devDependencies":{"autod":"^3.0.1","egg":"^2.11.2","egg-bin":"^4.9.0","egg-ci":"^1.9.2","egg-mock":"^3.20.1","egg-security":"^1.2.1","eslint":"^5.6.1","eslint-config-egg":"^7.1.0","supertest":"^3.3.0"},"engines":{"node":">=8.0.0"},"scripts":{"test":"npm run lint -- --fix && egg-bin pkgfiles && npm run test-local","test-local":"egg-bin test","cov":"egg-bin cov","lint":"eslint .","ci":"egg-bin pkgfiles --check && npm run lint && npm run cov","autod":"autod"},"bug":{"url":"https://github.com/eggjs/egg/issues"},"ci":{"version":"8, 10"},"author":{"name":"dead_horse"},"gitHead":"7ae83b302fa7083203c45c6363d959ee37c9dab9","bugs":{"url":"https://github.com/eggjs/egg-cors/issues"},"homepage":"https://github.com/eggjs/egg-cors#readme","_id":"egg-cors@2.2.2","_nodeVersion":"10.15.1","_npmVersion":"6.11.3","dist":{"integrity":"sha512-UXW1MECitp9Wh335wuLpqZqlQPPKhroyk5y3sR46x0Bc+zsLK0wTqLh0brVg1gBboqG7aPmqet2g/6sQmYEAYg==","shasum":"0bd9aa5e2c9e4d801b482dd14270d8b19ee71662","tarball":"http://registry-npm.ywwl.com/egg-cors/download/egg-cors-2.2.2.tgz","fileCount":8,"unpackedSize":8142,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdswYeCRA9TVsSAnZWagAAvVYQAIo2YftTLcxnp8QZM6Xg\nIE0tSLC6Qi482CYUq2rVedaZ4PA6qlulcI2xHc+K4CUJ/BMqTjjoKLRkF8oG\nsqPNjMaLlC5PIk4vFF0goHlhkLntaTxoOAEZyzB8baOj1zzVxUGmqEbUjETq\ngndNxI3GpnFTTzfmFKhyygMXWUqvl3walLym15YYWsrb7Vx3UtR4SZXKXZFp\n1dFN3/e9jCJBnB+XGuUq7z2+fwCUSgUP85BZQ2Z2UkQ5PGoTdFfiOlRQ02ge\ntUPKI9U4mhfxgngRwqd2Gvy5Q0SPSYKzilfg9DNmaV8moK8Xun3EZgJgyBZM\nwaxXcBNtgzibNZIi500J1B5wzjyQMrM+ODCJ2NMZXSmg9pleorWm5x718HvT\nxn1QEOAwNTLBWEGoUZ51YUo1Wb0Jnqj2CxhnRARSuRM2hfKxG6Z7vGDCPlmF\nrkLFzzu5MNWSWmJ/8Gr3GBYeSEeOuhwZrXkfQ6w/hixFQ/hque3U2MtCCK3h\nNyFwr7jNyYNBfkSMdYKs6ULt9KX3OE0D0JgjcAo1RLrInPyNVW9l0mf0kKwL\nEzyY9RW7qA6lcEpPxGVdw95A5bg59ziJx6arDpqGTmsaJgLGNdqsSdFDjIY4\na0Mzc7VWR8S39tCOEWto6XO3zvO3Nc+RvBKA3PYamw8qm/c5WE7U/DDv8QGF\naxLw\r\n=nv0y\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAcGrZSdaFvEqZEfTXX1Y4/zusIuLKZgVLiXnd7vrjXbAiB5laNqEe1qGfDNskJiQ8N4GCQQPp9P3XPXYs+1zq0u4Q=="}],"size":3850,"noattachment":false,"key":"/egg-cors/-/egg-cors-2.2.2.tgz"},"maintainers":[{"name":"atian25","email":"atian25@qq.com"},{"name":"dead_horse","email":"dead_horse@qq.com"},{"name":"eggjs","email":"fengmk2+eggjs@gmail.com"},{"name":"fengmk2","email":"fengmk2@gmail.com"},{"name":"popomore","email":"sakura9515@gmail.com"}],"_npmUser":{"name":"atian25","email":"atian25@qq.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/egg-cors_2.2.2_1572013598313_0.6089610197332014"},"_hasShrinkwrap":false,"readme":"# egg-cors\n\n[![NPM version][npm-image]][npm-url]\n[![Node.js CI](https://github.com/eggjs/egg-cors/actions/workflows/nodejs.yml/badge.svg)](https://github.com/eggjs/egg-cors/actions/workflows/nodejs.yml)\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/egg-cors.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/egg-cors\n[codecov-image]: https://codecov.io/github/eggjs/egg-cors/coverage.svg?branch=master\n[codecov-url]: https://codecov.io/github/eggjs/egg-cors?branch=master\n[download-image]: https://img.shields.io/npm/dm/egg-cors.svg?style=flat-square\n[download-url]: https://npmjs.org/package/egg-cors\n\n[CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) plugin for egg, based on [@koa/cors](https://github.com/koajs/cors).\n\n## Install\n\n```bash\n$ npm i egg-cors --save\n```\n\n## Usage\n\n```js\n// {app_root}/config/plugin.js\nexports.cors = {\n  enable: true,\n  package: 'egg-cors',\n};\n```\n\n`egg-cors` works internally with [egg-security](https://github.com/eggjs/egg-security). By defining the property of `domainWhiteList` on object `security`, you have successfully informed the framework to whitelist the passed domains.\n\nWhen you make a request from client side, **egg** should return an `Access-Control-Allow-Origin` response header with the domain that you passed in along with the payload and status code *200*.\n\n```js\nexports.security = {\n  domainWhiteList: [ 'http://localhost:4200' ],\n};\n```\n\n## Configuration\n\nSupport all configurations in [@koa/cors](https://github.com/koajs/cors).\n\n```js\n// {app_root}/config/config.default.js\nexports.cors = {\n  // {string|Function} origin: '*',\n  // {string|Array} allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH'\n};\n```\n\nIf the `origin` is set, the plugin will follow it to set the `Access-Control-Allow-Origin` and ignore the `security.domainWhiteList`. Otherwise, the `security.domainWhiteList` which is default will take effect as described above.\n\n## Security\n\nOnly in safe domain list support CORS when security plugin enabled.\n\n## Questions & Suggestions\n\nPlease open an issue [here](https://github.com/eggjs/egg/issues).\n\n## License\n\n[MIT](LICENSE)\n\n<!-- GITCONTRIBUTOR_START -->\n\n## Contributors\n\n|[<img src=\"https://avatars.githubusercontent.com/u/227713?v=4\" width=\"100px;\"/><br/><sub><b>atian25</b></sub>](https://github.com/atian25)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/985607?v=4\" width=\"100px;\"/><br/><sub><b>dead-horse</b></sub>](https://github.com/dead-horse)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/156269?v=4\" width=\"100px;\"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/3139237?v=4\" width=\"100px;\"/><br/><sub><b>brickyang</b></sub>](https://github.com/brickyang)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/3297859?v=4\" width=\"100px;\"/><br/><sub><b>sinchang</b></sub>](https://github.com/sinchang)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/2842176?v=4\" width=\"100px;\"/><br/><sub><b>XadillaX</b></sub>](https://github.com/XadillaX)<br/>|\n| :---: | :---: | :---: | :---: | :---: | :---: |\n[<img src=\"https://avatars.githubusercontent.com/u/1148428?v=4\" width=\"100px;\"/><br/><sub><b>mattma</b></sub>](https://github.com/mattma)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/20397245?v=4\" width=\"100px;\"/><br/><sub><b>SoraYama</b></sub>](https://github.com/SoraYama)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/9161488?v=4\" width=\"100px;\"/><br/><sub><b>Yelmor</b></sub>](https://github.com/Yelmor)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/6895141?v=4\" width=\"100px;\"/><br/><sub><b>angela-1</b></sub>](https://github.com/angela-1)<br/>|[<img src=\"https://avatars.githubusercontent.com/u/1763067?v=4\" width=\"100px;\"/><br/><sub><b>waitingsong</b></sub>](https://github.com/waitingsong)<br/>\n\nThis project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Mon Dec 11 2023 13:25:00 GMT+0800`.\n\n<!-- GITCONTRIBUTOR_END -->\n","publish_time":1572013598457,"_cnpm_publish_time":1572013598457,"dist-tags":{"latest":"3.0.1","latest-2":"2.2.4"}}