https://github.com/anzerr/proxy.util
https://github.com/anzerr/proxy.util
http nodejs proxy util
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/anzerr/proxy.util
- Owner: anzerr
- License: mit
- Created: 2018-12-26T18:02:32.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-21T16:28:02.000Z (about 4 years ago)
- Last Synced: 2025-10-02T01:44:58.702Z (6 months ago)
- Topics: http, nodejs, proxy, util
- Language: JavaScript
- Size: 73.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
### `Intro`

Proxy request to a server transforming the headers or url
#### `Install`
``` bash
npm install --save git+https://github.com/anzerr/proxy.util.git
npm install --save @anzerr/proxy.util
```
### `Example`
``` javascript
const Proxy = require('proxy.util'),
{Server} = require('http.server');
let proxy = new Proxy('https://www.google.com'),
http = new Server(8080);
proxy.on('request', (req) => {
console.log('forward url', req.url);
req.done();
});
http.create((req, res) => {
proxy.forward(req._req, res._res).catch((e) => {
res.status(500).send(e.toString());
});
}).then(() => {
console.log('started server on port', 8080);
});
```