@sebastiandg7/local-cors-proxy
Advanced tools
Comparing version 1.1.0 to 1.1.1
#!/usr/bin/env node | ||
var lcp = require('../lib/index.js'); | ||
var commandLineArgs = require('command-line-args'); | ||
var lcp = require("../lib/index.js"); | ||
var commandLineArgs = require("command-line-args"); | ||
var optionDefinitions = [ | ||
{ name: 'port', alias: 'p', type: Number, defaultValue: 8010 }, | ||
{ name: "port", alias: "p", type: Number, defaultValue: 8010 }, | ||
{ | ||
name: 'proxyPartial', | ||
name: "proxyPartial", | ||
type: String, | ||
defaultValue: '/proxy' | ||
defaultValue: "/proxy", | ||
}, | ||
{ name: 'proxyUrl', type: String }, | ||
{ name: 'credentials', type: Boolean, defaultValue: false }, | ||
{ name: 'origin', type: String, defaultValue: '*' }, | ||
{ name: 'removeRequestOrigin', type: Boolean, defaultValue: false } | ||
{ name: "proxyUrl", type: String }, | ||
{ name: "credentials", type: Boolean, defaultValue: false }, | ||
{ name: "origin", type: String, defaultValue: "*" }, | ||
{ name: "removeRequestOrigin", type: Boolean, defaultValue: false }, | ||
]; | ||
@@ -21,8 +21,25 @@ | ||
var options = commandLineArgs(optionDefinitions); | ||
if (!options.proxyUrl) { | ||
throw new Error('--proxyUrl is required'); | ||
const { | ||
port, | ||
proxyUrl, | ||
proxyPartial, | ||
credentials, | ||
origin, | ||
removeRequestOrigin, | ||
} = options; | ||
if (!proxyUrl) { | ||
throw new Error("--proxyUrl is required"); | ||
} | ||
lcp.startProxy(options.port, options.proxyUrl, options.proxyPartial, options.credentials, options.origin); | ||
lcp.startProxy( | ||
port, | ||
proxyUrl, | ||
proxyPartial, | ||
credentials, | ||
origin, | ||
removeRequestOrigin | ||
); | ||
} catch (error) { | ||
console.error(error); | ||
} |
{ | ||
"name": "@sebastiandg7/local-cors-proxy", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "./lib/index.js", | ||
@@ -5,0 +5,0 @@ "scripts": { |
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
6522
86