koajs/cors

how to set options?

csrgxtu opened this issue · 2 comments

how do i set options

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. 😅