{ "_args": [ [ { "raw": "koa-cors", "scope": null, "escapedName": "koa-cors", "name": "koa-cors", "rawSpec": "", "spec": "latest", "type": "tag" }, "/Users/fzy/project/3mang" ] ], "_from": "koa-cors@latest", "_id": "koa-cors@0.0.16", "_inCache": true, "_location": "/koa-cors", "_nodeVersion": "0.12.4", "_npmUser": { "name": "evert0n", "email": "everton@notreve.com" }, "_npmVersion": "2.10.1", "_phantomChildren": {}, "_requested": { "raw": "koa-cors", "scope": null, "escapedName": "koa-cors", "name": "koa-cors", "rawSpec": "", "spec": "latest", "type": "tag" }, "_requiredBy": [ "#DEV:/", "#USER" ], "_resolved": "https://registry.npmjs.org/koa-cors/-/koa-cors-0.0.16.tgz", "_shasum": "98107993a7909e34c042986c5ec6156d77f3432e", "_shrinkwrap": null, "_spec": "koa-cors", "_where": "/Users/fzy/project/3mang", "author": { "name": "Everton Yoshitani" }, "bugs": { "url": "https://github.com/evert0n/koa-cors/issues" }, "dependencies": {}, "description": "CORS middleware for Koa", "devDependencies": { "chai": "^2.0.0", "koa": "^0.18.0", "mocha": "^2.1.0", "superagent": "^0.21.0" }, "directories": {}, "dist": { "shasum": "98107993a7909e34c042986c5ec6156d77f3432e", "tarball": "https://registry.npmjs.org/koa-cors/-/koa-cors-0.0.16.tgz" }, "gitHead": "6e136afbba2c7b1048a7435e195894b29202935b", "homepage": "https://github.com/evert0n/koa-cors", "keywords": [ "cors", "koa", "koajs" ], "license": "MIT", "main": "index.js", "maintainers": [ { "name": "evert0n", "email": "everton@notreve.com" } ], "name": "koa-cors", "optionalDependencies": {}, "readme": "koa-cors\n========\n\nCORS middleware for Koa\n\nInspired by the great [node-cors](https://github.com/troygoode/node-cors) module.\n\n## Installation (via [npm](https://npmjs.org/package/koa-cors))\n\n```bash\n$ npm install koa-cors\n```\n\n## Usage\n\n```javascript\nvar koa = require('koa');\nvar route = require('koa-route');\nvar cors = require('koa-cors');\nvar app = koa();\n\napp.use(cors());\n\napp.use(route.get('/', function() {\n this.body = { msg: 'Hello World!' };\n}));\n\napp.listen(3000);\n```\n\n## Options\n\n### origin\n\nConfigures the **Access-Control-Allow-Origin** CORS header. Expects a string\n(ex: http://example.com). Set to `true` to reflect the\n[request origin](http://tools.ietf.org/html/draft-abarth-origin-09), as defined\nby `req.header('Origin')`. Set to `false` to disable CORS. Can also be set to a\nfunction, which takes the request as the first parameter.\n\n### expose\n\nConfigures the **Access-Control-Expose-Headers** CORS header. Expects a\ncomma-delimited string (ex: 'WWW-Authenticate,Server-Authorization') or an array\n(ex: `['WWW-Authenticate', 'Server-Authorization]`). Set this to pass the\nheader, otherwise it is omitted.\n\n### maxAge\n\nConfigures the **Access-Control-Max-Age** CORS header. Set to an integer to pass\nthe header, otherwise it is omitted.\n\n### credentials\n\nConfigures the **Access-Control-Allow-Credentials** CORS header. Set to `true`\nto pass the header, otherwise it is omitted.\n\n### methods\n\nConfigures the **Access-Control-Allow-Methods** CORS header. Expects a\ncomma-delimited string (ex: 'GET,PUT,POST') or an array (ex: `['GET', 'PUT',\n'POST']`).\n\n### headers\nConfigures the **Access-Control-Allow-Headers** CORS header. Expects a\ncomma-delimited string (ex: 'Content-Type,Authorization') or an array (ex:\n`['Content-Type', 'Authorization]`). If not specified, defaults to reflecting\nthe headers specified in the request's **Access-Control-Request-Headers**\nheader.\n\n\nFor details on the effect of each CORS header,\n[read this article on HTML5 Rocks](http://www.html5rocks.com/en/tutorials/cors/).\n\n\n## License\n\n[MIT License](http://www.opensource.org/licenses/mit-license.php)\n\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git+https://github.com/evert0n/koa-cors.git" }, "scripts": { "test": "mocha --harmony test" }, "version": "0.0.16" }