npm install felid-cors
or
yarn add felid-cors
const Felid = require('felid')
const cors = require('felid-cors')
const app = new Felid()
app.plugin(cors, {
origin: '*', // set the `access-control-allow-origin` header, default is the request `Origin` header.
allowMethods: ['GET,POST'], // set the `access-control-allow-methods` header, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'.
exposeHeaders: ['expose', 'headers'], // set the `access-control-expose-headers` header.
allowHeaders: ['allow', 'headers'], // set the `access-control-allow-headers` header.
maxAge: 3600, // set the `access-control-max-age` header, in seconds.
credentials: true // set the `access-control-credentials` header.
})
For details, please check corsen.