@anzerr/proxy.util
TypeScript icon, indicating that this package has built-in type declarations

1.0.14 • Public • Published

Intro

GitHub Actions status | publish

Proxy request to a server transforming the headers or url

Install

npm install --save git+https://github.com/anzerr/proxy.util.git
npm install --save @anzerr/proxy.util

Example

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);
});

Readme

Keywords

Package Sidebar

Install

npm i @anzerr/proxy.util

Weekly Downloads

22

Version

1.0.14

License

MIT

Unpacked Size

4.92 kB

Total Files

7

Last publish

Collaborators

  • anzerr