2.0.0 • Published 5 years ago

http-cors v2.0.0

Weekly downloads
130
License
MIT
Repository
github
Last release
5 years ago

http-cors

Respond correctly to a CORS request

Installation

npm install http-cors

Usage

const http = require('http')
const cors = require('http-cors') // use default options
// const cors = require('http-cors').setup({origin:'example.com'}) // overwrite default options

var server = http.createServer(function(request, response) {
  if (cors(request, response)) return // this was an OPTIONS request - no further action needed

  // do your things
})

server.listen(process.env.PORT || 80)

License

MIT © src.agency

2.0.0

5 years ago

1.0.2

7 years ago

1.0.1

9 years ago

1.0.0

10 years ago