Jason Smylnycky b4d51d194c Converted url.parse over to URL object
Updated 'var' to let/const where appropriate
2020-01-16 10:41:45 -05:00

17 lines
483 B
JavaScript

const { createProxyServer } = require('../../');
const http = require('http');
const proxy = createProxyServer({});
const agent = new http.Agent({ keepAlive: true})
const server = http.createServer(function(req, res) {
// You can define here your custom logic to handle the request
// and then proxy the request.
proxy.web(req, res, {
target: 'http://localhost:9000',
agent: agent
});
});
console.log('listening on port 8000');
server.listen(8000);