Package Exports
- global-proxy-setter
- global-proxy-setter/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (global-proxy-setter) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
global-proxy-setter
A simple utility to set HTTP and HTTPS proxies for Node.js applications using the global-agent
package.
Installation
To install this package globally, run:
npm install -g global-proxy-setter
You can also use npm link
for local development:
npm link
Usage
To use this package, you need to preload it when starting your Node.js application:
node -r global-proxy-setter your-app.js
The default proxy port is 1086. If you want to change it, set the SET_PROXY_PORT
environment variable before running your application:
export SET_PROXY_PORT=7890
node -r global-proxy-setter your-app.js
Configuration
If you need to change the default proxy port (1086), you can modify the start script in package.json:
"scripts": {
"start:proxy": "export NODE_PATH=$(npm root -g) && export SET_PROXY_PORT=7890 && node -r global-proxy-setter your-app.js"
}
Important note
If you face issues with node -r global-proxy-setter
and receive a "MODULE_NOT_FOUND" error, it could be due to Node.js not checking your global node_modules
directory.
You can fix this by adding the global node_modules
directory to your NODE_PATH
environment variable:
export NODE_PATH=$(npm root -g)
After doing this, you should be able to run node -r global-proxy-setter
without any issues.
License
This project is licensed under the terms of the ISC license.