Skip to content

mehdivk/restify-cors-middleware

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:https://api.myapp.com', 'http:https://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.

About

CORS middleware with full W3C spec support

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%