corsify
CORS up a route handler
Example
var Corsify = var http = // cors headers sethttp
Example creating shared corsify
var Corsify = var Router = var cors = var app = appappapp http
Documentation
Corsify(opts: Object, handler: (req, res)) => (req, res)
Corsify
can be called with options
var opts = // if this is set to false then preflight `OPTIONS` is // not terminated endOptions: Boolean // if you want to compute the allowed origin manually you // pass in a getOrigin function String // these are default header values you can set. Corsify // has sensible defaults. You can't use Allow-Origin and // getOrigin at the same time. "Access-Control-Allow-Origin": String "Access-Control-Allow-Methods": String "Access-Control-Allow-Credentials": String "Access-Control-Allow-Max-Age": String "Access-Control-Allow-Headers": String
Installation
npm install corsify
Contributors
- Raynos