Neverending Puppy Marathon

    @nicolasparada/cors-middleware

    0.2.0 • Public • Published

    @nicolasparada/cors-middleware npm version

    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 or Function. Defaults to 'Origin' request header or '*'. Set to 'false' to disable CORS)
    • expose: Access-Control-Expose-Headers (Array or String)
    • maxAge: Access-Control-Max-Age (Int)
    • credentials: Access-Control-Allow-Credentials (Boolean)
    • methods: Access-Control-Allow-Methods (Array or String)
    • headers: Access-Control-Allow-Headers (Array or String. Defaults to 'Access-Control-Request-Headers' request header)

    Install

    npm i @nicolasparada/cors-middleware

    DownloadsWeekly Downloads

    9

    Version

    0.2.0

    License

    MIT

    Last publish

    Collaborators

    • nicolasparada