http-proxy-lite
v1.0.6
Published
a tiny http proxy of node.js
Downloads
2
Readme
http-proxy-lite
a tiny http proxy of node.js
Installation
npm i http-proxy-lite -S
Usage
proxy server
import * as http from 'http';
import * as httpProxy from 'http-proxy-lite';
const proxy = httpProxy.createProxyServer();
http
.createServer(function(req, res) {
proxy.web(req, res, { target: 'http://127.0.0.1:3001' });
})
.listen(3000);
endpoint server
import * as http from 'http';
http
.createServer(function(req, res) {
res.end('hello, response from 3001');
})
.listen(3001);
then open http://localhost:3000/
with your browser, it will shows hello, response from 3001
Todo
- [ ] xxxx
License
MIT