felid-cors

A cors plugin for Felid.js


Keywords
cors, felid, felid-plugin, felidjs
License
MIT
Install
npm install felid-cors@1.0.5

Documentation

felid-cors

npm version Build Status JavaScript Style Guide

A Felid plugin for CORS.

Install

npm install felid-cors

or

yarn add felid-cors

Usage

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.

License

MIT