Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amio/micro-cors

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amio/micro-cors - npm Package Compare versions

Comparing version 0.0.5 to 0.0.6

.travis.yml

67

package.json
{
"name": "@amio/micro-cors",
"version": "0.0.6",
"description": "Simple CORS middleware for Zeit's Micro",
"version": "0.0.5",
"engines": {
"node": ">=6"
},
"repository": {
"url": "https://github.com/possibilities/micro-cors",
"type": "git"
},
"author": "Mike Bannister <mikebannister@gmail.com>",
"main": "lib/index.js",
"files": [
"lib/index.js"
"repository": "https://github.com/amio/micro-cors",
"contributors": [
"Mike Bannister <mikebannister@gmail.com>",
"Amio <amio.cn@gmail.com>"
],
"main": "index.js",
"license": "MIT",
"scripts": {
"build": "rimraf lib && babel src --out-dir lib",
"test": "ava --verbose src/test.js",
"dev": "ava --verbose --watch src/test.js",
"prepublish": "yarn build",
"lint": "standard",
"pretest": "standard"
"test": "ava --verbose test/*.spec.js",
"dev": "ava --verbose --watch test/*.spec.js",
"prepublishOnly": "npm run test",
"pretest": "npm run lint"
},
"devDependencies": {
"async-to-gen": "^1.3.2",
"ava": "^0.19.0",
"babel-cli": "^6.24.0",
"babel-polyfill": "^6.23.0",
"babel-preset-latest": "^6.24.0",
"babel-preset-stage-0": "^6.22.0",
"babel-register": "^6.24.0",
"micro": "^7.3.0",
"request-promise": "^4.2.0",
"rimraf": "^2.6.1",
"@babel/cli": "^7.0.0-beta.49",
"@babel/core": "^7.0.0-beta.49",
"@babel/preset-env": "^7.0.0-beta.49",
"ava": "^0.25.0",
"micro": "^9.3.0",
"request": "^2.87.0",
"request-promise": "^4.2.2",
"rimraf": "^2.6.2",
"standard": "^10.0.0",
"test-listen": "^1.0.1"
"test-listen": "^1.1.0"
},
"ava": {
"failFast": true,
"require": [
"babel-register"
],
"babel": "inherit"
"failFast": true
},
"babel": {
"presets": [
"latest",
"stage-0"
[
"@babel/preset-env",
{
"shippedProposals": true,
"targets": {
"node": "6.10"
}
}
]
]
},
"engines": {
"node": ">=6"
}
}

@@ -1,16 +0,15 @@

# CORS middleware for Micro
# micro-cors
### Summary
Simple [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) middleware for Zeit's [Micro](https://github.com/zeit/micro)
[![CircleCI](https://circleci.com/gh/possibilities/micro-cors.svg?style=svg)](https://circleci.com/gh/possibilities/micro-cors)
[![][npm-badge]][npm-link]
[![Build Status](https://travis-ci.com/amio/micro-cors.svg?branch=master)](https://travis-ci.com/amio/micro-cors)
### Install
## Install
```
yarn add micro-cors
npm install @amio/micro-cors
```
### Usage
## Usage

@@ -20,6 +19,7 @@ Basic

```js
const cors = require('micro-cors')()
const handler = (req, res) => send(res, 200, 'ok!')
const micro = require('micro')
const cors = require('micro-cors')
const handler = (req, res) => micro.send(res, 200, 'ok!')
module.exports = cors(handler)
module.exports = cors()(handler)
```

@@ -30,25 +30,35 @@

```js
const microCors = require('micro-cors')
const cors = microCors({ allowMethods: ['PUT', 'POST'] })
const handler = (req, res) => send(res, 200, 'ok!')
const micro = require('micro')
const cors = require('micro-cors')
const handler = (req, res) => micro.send(res, 200, 'ok!')
module.exports = cors(handler)
const opts = { allowMethods: 'PUT,POST' }
module.exports = cors(opts)(handler)
```
#### Options
### Options
##### `allowMethods`
##### `allowMethods` &lt;String>
default: `['POST','GET','PUT','DELETE','OPTIONS']`
default: `'POST,GET,PUT,PATCH,DELETE,OPTIONS'`
##### `allowHeaders`
##### `allowHeaders` &lt;String>
default: `['X-Requested-With','Access-Control-Allow-Origin','X-HTTP-Method-Override','Content-Type','Authorization','Accept']`
default: `'X-Requested-With,Access-Control-Allow-Origin,X-HTTP-Method-Override,Content-Type,Authorization,Accept'`
##### `maxAge`
##### `exposeHeaders` &lt;String>
default: `undefined`
##### `maxAge` &lt;String>
default: `86400`
##### `origin`
##### `origin` &lt;String>
default: `*`
[npm-badge]: https://img.shields.io/npm/v/@amio/micro-cors.svg
[npm-link]: https://www.npmjs.com/package/@amio/micro-cors
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc