Socket
Socket
Sign inDemoInstall

micro-cors

Package Overview
Dependencies
0
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    micro-cors

Simple CORS middleware for Zeit's Micro


Version published
Weekly downloads
37K
increased by9.81%
Maintainers
1
Install size
6.47 kB
Created
Weekly downloads
 

Readme

Source

CORS middleware for Micro

Summary

Simple CORS middleware for Zeit's Micro

CircleCI

Install

yarn add micro-cors

Usage

Basic

const cors = require('micro-cors')()
const handler = (req, res) => send(res, 200, 'ok!')

module.exports = cors(handler)

With options

const microCors = require('micro-cors')
const cors = microCors({ allowMethods: ['PUT', 'POST'] })
const handler = (req, res) => send(res, 200, 'ok!')

module.exports = cors(handler)
Options
allowMethods

default: ['POST','GET','PUT','PATCH','DELETE','OPTIONS']

allowHeaders

default: ['X-Requested-With','Access-Control-Allow-Origin','X-HTTP-Method-Override','Content-Type','Authorization','Accept']

allowCredentials

default: true

exposeHeaders

default: []

maxAge

default: 86400

origin

default: *

FAQs

Last updated on 05 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc