0.0.4 • Published 12 months ago

global-proxy-setter v0.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

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.

0.0.4

12 months ago

0.0.3

12 months ago

0.0.2

12 months ago

0.0.1

12 months ago