0.2.0 • Published 11 years ago

w3c-cors v0.2.0

Weekly downloads
33
License
-
Repository
github
Last release
11 years ago

CORS

CORS configuration middleware.

Installation

npm install w3c-cors

Usage

CORS middleware needs to be configured. You can configure it with an argument like this one :

{
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "Authorisation, X-Requested-With"
}

it can be loaded by passing an object or a function.

Because configuration options are plain W3C specification terms, you can get every attributes from W3C CORS specification

examples

configuration throw object :

CORS({
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Allow-Headers": "Authorisation, X-Requested-With"
})

configuration throw a json file:

CORS(function() {
    return require(__dirname + '/config.json');
})

a full example using express is available in the example directory.

License

MIT License, see LICENSE

0.2.0

11 years ago

0.1.4

11 years ago

0.1.3

11 years ago

0.1.2

11 years ago

0.1.1

11 years ago

0.1.0

11 years ago