@nicolasparada/cors-middleware
v0.2.0
Published
CORS Middleware
Downloads
1
Maintainers
Readme
@nicolasparada/cors-middleware
CORS Middleware
Usage
const framework = require('@nicolasparada/web-framework')
const cors = require('@nicolasparada/cors-middleware')
const middlewares = [
cors()
]
const app = framework(middlewares)
app.listen(80, '127.0.0.1', () => {
console.log('Server running at http://localhost/')
})
Options
- origin: Access-Control-Allow-Origin (
String
,Boolean
orFunction
. Defaults to 'Origin' request header or '*'. Set to 'false' to disable CORS) - expose: Access-Control-Expose-Headers (
Array
orString
) - maxAge: Access-Control-Max-Age (
Int
) - credentials: Access-Control-Allow-Credentials (
Boolean
) - methods: Access-Control-Allow-Methods (
Array
orString
) - headers: Access-Control-Allow-Headers (
Array
orString
. Defaults to 'Access-Control-Request-Headers' request header)