mirror of
https://github.com/scratchfoundation/restify-cors-middleware.git
synced 2024-12-18 11:52:26 -05:00
CORS middleware with full W3C spec support
65dcdef6ed
Travis CI Integration |
||
---|---|---|
src | ||
test | ||
.gitignore | ||
.travis.yml | ||
package.json | ||
README.md |
restify-cors-middleware
CORS middleware with full W3C spec support.
Usage
var corsMiddleware = require('restify-cors-middleware');
var cors = corsMiddleware({
preflightMaxAge: 5, //Optional
origins: ['http://api.myapp.com', 'http://web.myapp.com'],
allowHeaders: ['API-Token'],
exposeHeaders: ['API-Token-Expiry']
});
server.pre(cors.preflight);
server.use(cors.actual);
Compliance to the spec
See unit tests for examples of preflight and actual requests.