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

lws-cors

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lws-cors - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

yarn.lock

15

index.js

@@ -1,4 +0,2 @@

'use strict'
class Cors {
module.exports = MiddlewareBase => class Cors extends MiddlewareBase {
description () {

@@ -21,10 +19,9 @@ return 'Cross-Origin Resource Sharing options.'

options = options || {}
const corsOptions = {}
if (options.corsOrigin) corsOptions.corsOrigin = options.corsOrigin
if (options.corsAllowMethods) corsOptions.corsAllowMethods = options.corsAllowMethods
this.emit('verbose', 'middleware.cors.config', corsOptions)
const kcors = require('kcors')
return kcors({
origin: options.corsOrigin,
allowMethods: options.corsAllowMethods
})
return kcors(corsOptions)
}
}
module.exports = Cors

7

package.json
{
"name": "lws-cors",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "0.2.0",
"version": "0.3.0",
"description": "lws-cors",

@@ -19,4 +19,7 @@ "repository": "https://github.com/lwsjs/cors.git",

"dependencies": {
"kcors": "^2.2.1"
"kcors": "^2.2.1",
"lws": "^1.0.0-pre2.1",
"req-then": "^0.6.2",
"test-runner": "^0.4.0"
}
}

@@ -7,4 +7,8 @@ [![view on npm](https://img.shields.io/npm/v/lws-cors.svg)](https://www.npmjs.org/package/lws-cors)

# cors
# lws-cors
See https://github.com/koajs/cors.
lws middleware to configure Cross-Origin Resource Sharing rules. For usage instructions, see [here](https://github.com/lwsjs/local-web-server/wiki/How-to-configure-Cross-Origin-Resource-Sharing-(CORS)).
* * *
&copy; 2017 Lloyd Brookes <75pound@gmail.com>.

@@ -1,6 +0,14 @@

var test = require('tape')
var lib = require('../')
const TestRunner = require('test-runner')
const Cors = require('./')
const Lws = require('lws')
const request = require('req-then')
test('first', function (t) {
const runner = new TestRunner()
runner.test('simple', async function () {
const port = 8000 + this.index
const lws = new Lws()
const server = lws.create({ port, stack: Cors })
const response = await request(`http://localhost:${port}/`)
server.close()
})
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