salak-cors
v1.0.2
Published
cors for salak or koa
Downloads
20
Readme
salak-cors
cors for salak 2.0, compatible for koa2.
Install
$ npm install --save salak-cors
Usage
Config
In middleware:
module.exports = {
middleware: [
{
name: 'cors',
package: 'salak-cors'
}
],
cors: { // options
origin: '*'
}
}
options
origin
{String|Function(ctx)}Access-Control-Allow-Origin
, default is request Origin headerallowMethods
{String|Array}Access-Control-Allow-Methods
, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'exposeHeaders
{String|Array}Access-Control-Expose-Headers
allowHeaders
{String|Array}Access-Control-Allow-Headers
maxAge
{String|Number}Access-Control-Max-Age
secondscredentials
{Boolean}Access-Control-Allow-Credentials