在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:koajs/cors开源软件地址:https://github.com/koajs/cors开源编程语言:JavaScript 100.0%开源软件介绍:@koa/corsCross-Origin Resource Sharing(CORS) for koa Installation$ npm install @koa/cors --save Quick startEnable cors with default options:
const Koa = require('koa');
const cors = require('@koa/cors');
const app = new Koa();
app.use(cors()); cors(options)/**
* CORS middleware
*
* @param {Object} [options]
* - {String|Function(ctx)} origin `Access-Control-Allow-Origin`, default is request Origin header
* - {String|Array} allowMethods `Access-Control-Allow-Methods`, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'
* - {String|Array} exposeHeaders `Access-Control-Expose-Headers`
* - {String|Array} allowHeaders `Access-Control-Allow-Headers`
* - {String|Number} maxAge `Access-Control-Max-Age` in seconds
* - {Boolean|Function(ctx)} credentials `Access-Control-Allow-Credentials`, default is false.
* - {Boolean} keepHeadersOnError Add set headers to `err.header` if an error is thrown
* - {Boolean} secureContext `Cross-Origin-Opener-Policy` & `Cross-Origin-Embedder-Policy` headers.', default is false
* - {Boolean} privateNetworkAccess handle `Access-Control-Request-Private-Network` request by return `Access-Control-Allow-Private-Network`, default to false
* @return {Function} cors middleware
* @api public
*/ LicenseContributors
This project follows the git-contributor spec, auto updated at |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论