@koa/cors
Cross-Origin Resource Sharing(CORS) for koa
Installation
$ npm install @koa/cors@2 --save
Quick start
Enable cors with default options:
- origin: request Origin header
- allowMethods: GET,HEAD,PUT,POST,DELETE,PATCH
const Koa = ;const cors = ; const app = ;app;
cors(options)
/** * CORS middleware * * @param * - {String|Function(ctx)} origin `Access-Control-Allow-Origin`, default is request Origin header * - * - * - * - * - * - * @return * @api public */