CORS middleware with full W3C spec support
Find a file
Romain Prieto 46cde52587 0.0.2
2014-05-08 17:58:32 +10:00
src First commit, supports 12/15 items of the spec 2014-05-08 12:16:17 +10:00
test First commit, supports 12/15 items of the spec 2014-05-08 12:16:17 +10:00
.gitignore First commit, supports 12/15 items of the spec 2014-05-08 12:16:17 +10:00
package.json 0.0.2 2014-05-08 17:58:32 +10:00
README.md Create README.md 2014-05-08 13:07:32 +10:00

restify-cors-middleware

CORS middleware with full W3C spec support.

Usage

var corsMiddleware = require('restify-cors-middleware');

var cors = corsMiddleware({
  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.