Socket
Book a DemoInstallSign in
Socket

@ahanapediatrics/cors

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ahanapediatrics/cors

Cross-Origin Resource Sharing(CORS) for koa

4.0.1
latest
Source
npmnpm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

@ahanapediatrics/cors

NPM version build status Test coverage David deps npm download

Cross-Origin Resource Sharing(CORS) for koa

Installation

$ npm install @ahanapediatrics/cors --save

Quick start

Enable cors with default options:

  • origin: request Origin header
  • allowMethods: GET,HEAD,PUT,POST,DELETE,PATCH
const Koa = require('koa');
const cors = require('@ahanapediatrics/cors');

const app = new Koa();
app.use(cors());

cors(options)

/**
 * CORS middleware
 *
 * @param {CORSOptions} [options]
 * @param [options.origin] `Access-Control-Allow-Origin`, default is request Origin header
 * @param [options.allowMethods] `Access-Control-Allow-Methods`, default is 'GET,HEAD,PUT,POST,DELETE,PATCH'
 * @param [options.exposeHeaders] `Access-Control-Expose-Headers`
 * @param [options.allowHeaders] `Access-Control-Allow-Headers`
 * @param [options.maxAge] `Access-Control-Max-Age` in seconds
 * @param [options.credentials] `Access-Control-Allow-Credentials`
 * @param [options.keepHeadersOnError] Add set headers to `err.header` if an error is thrown
 * 
 * @return {Middleware} Koa middleware
 * @api public
 */

License

MIT

Keywords

cors

FAQs

Package last updated on 05 Feb 2020

Did you know?

Socket

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.