koajs / cors

Cross-Origin Resource Sharing(CORS) for koa
Other
732 stars 82 forks source link

how to set options? #19

Open csrgxtu opened 8 years ago

csrgxtu commented 8 years ago

how do i set options

artworkad commented 7 years ago

@csrgxtu should be cors(options) https://github.com/koajs/cors/blob/master/index.js#L19

wesleyboar-fka-iosulfur commented 5 years ago

To answer, I present one change to the final statement from the example code in "Quick Start" of README.md at tag 3.0.0:

const Koa = require('koa');
const cors = require('@koa/cors');

const app = new Koa();
app.use(cors({
    // …
    allowMethods: 'GET,HEAD',
    keepHeadersOnError: true,
    // …
}));

Does this help?


Edit: The post is three years old. 😅