Comparing version 1.0.0 to 2.0.0
17
index.js
@@ -1,5 +0,8 @@ | ||
module.exports = MiddlewareBase => class Cors extends MiddlewareBase { | ||
const EventEmitter = require('events') | ||
class Cors extends EventEmitter { | ||
description () { | ||
return 'Support for setting Cross-Origin Resource Sharing (CORS) headers.' | ||
} | ||
optionDefinitions () { | ||
@@ -22,8 +25,8 @@ return [ | ||
} | ||
middleware (options) { | ||
options = options || {} | ||
middleware (config) { | ||
const corsOptions = {} | ||
if (options.corsOrigin) corsOptions.origin = options.corsOrigin | ||
if (options.corsAllowMethods) corsOptions.allowMethods = options.corsAllowMethods | ||
if (options.corsCredentials) corsOptions.credentials = options.corsCredentials | ||
if (config.corsOrigin) corsOptions.origin = config.corsOrigin | ||
if (config.corsAllowMethods) corsOptions.allowMethods = config.corsAllowMethods | ||
if (config.corsCredentials) corsOptions.credentials = config.corsCredentials | ||
this.emit('verbose', 'middleware.cors.config', corsOptions) | ||
@@ -34,1 +37,3 @@ const kcors = require('@koa/cors') | ||
} | ||
module.exports = Cors |
{ | ||
"name": "lws-cors", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "1.0.0", | ||
"version": "2.0.0", | ||
"description": "Support for setting Cross-Origin Resource Sharing (CORS) headers to lws", | ||
@@ -13,3 +13,3 @@ "repository": "https://github.com/lwsjs/cors.git", | ||
"engines": { | ||
"node": ">=7.6" | ||
"node": ">=8" | ||
}, | ||
@@ -20,9 +20,12 @@ "scripts": { | ||
"dependencies": { | ||
"@koa/cors": "^2.2.1" | ||
"@koa/cors": "^3.0.0" | ||
}, | ||
"devDependencies": { | ||
"lws": "^1.1.4", | ||
"req-then": "^0.6.4", | ||
"test-runner": "^0.4.0" | ||
} | ||
"lws": "^2.0.0-7", | ||
"node-fetch": "^2.6.0", | ||
"test-runner": "^0.6.0" | ||
}, | ||
"files": [ | ||
"index.js" | ||
] | ||
} |
[![view on npm](https://img.shields.io/npm/v/lws-cors.svg)](https://www.npmjs.org/package/lws-cors) | ||
[![npm module downloads](https://img.shields.io/npm/dt/lws-cors.svg)](https://www.npmjs.org/package/lws-cors) | ||
[![Build Status](https://travis-ci.org/lwsjs/cors.svg?branch=master)](https://travis-ci.org/lwsjs/cors) | ||
[![Dependency Status](https://david-dm.org/lwsjs/cors.svg)](https://david-dm.org/lwsjs/cors) | ||
[![Dependency Status](https://badgen.net/david/dep/lwsjs/cors)](https://david-dm.org/lwsjs/cors) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard) | ||
@@ -13,2 +13,2 @@ | ||
© 2017 Lloyd Brookes <75pound@gmail.com>. | ||
© 2016-19 Lloyd Brookes \<75pound@gmail.com\>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14
3628
4
33
+ Added@koa/cors@3.4.3(transitive)
- Removed@koa/cors@2.2.3(transitive)
Updated@koa/cors@^3.0.0