function
const http = require('http') const httpProxy = require('http-proxy') const proxy = httpProxy.createProxyServer({}) http.createServer(function (req, res) { proxy.web(req, res, { target: 'http://localhost:3000' }) }).listen(3333) proxy.on('error', function (err, req, res) { if (err) console.log(err) res.writeHead(500) res.end('Ooops, something went very wrong...') })
websocket support
proxyServer.on('upgrade', function (req, socket, head) { proxy.ws(req, socket, head); });

Seonglae Cho