/ archiveofbelonging.org / back / node_modules / @koa / cors /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[TXT]History.md40 years ago2.7K 
[   ]LICENSE40 years ago1.1K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[TXT]README.md40 years ago2.0Kf12eb36 documentaiton updates [كارل مبارك]
[   ]index.js40 years ago4.2K 
[   ]package.json2 years ago2.0K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
README.md

@koa/cors

NPM version build status Test coverage David deps npm download

Cross-Origin Resource Sharing(CORS) for koa

Installation

$ npm install @koa/cors --save

Quick start

Enable 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
 * @return {Function} cors middleware
 * @api public
 */

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80