minimal-http-proxy

1.7.1 • Public • Published

minimal-http-proxy

Build Status js-standard-style npm version Coverage Status

Install

npm install

Usage

npm start [PORT]

  const createProxyServer = require('minimal-http-proxy/server')
  const proxyRequest = require('minimal-http-proxy')
  // request, but trough a proxy
  const proxyServer = createProxyServer(8888)
  const req = proxyRequest({
    // options that will be send to the proxy server
    hostname: 'localhost',
    port: 9090,
    method: 'POST',
    protocol: 'https', // make request over https (optional)
    proxy: {
      // all proxy specific options
      protocol: 'https', // make request over https
      hostname: 'localhost',
      port: 8888,
      method: 'POST'
    }
  }, (res) => {
    var data = ''
    res.on('data', (chunk) => {
      data += chunk
    })
    res.on('end', () => {
      console.log('succes!')
      server.close()
      proxyServer.close()
    })
  })
  req.write('!')
  req.end()

As a query parameter (basic)

proxy.url.com?proxy=http://google.com

As a query parameter with options

proxy.url.com?proxy={ "host": "google.com", "headers": { "lulz": tue } }

Readme

Keywords

Package Sidebar

Install

npm i minimal-http-proxy

Weekly Downloads

1

Version

1.7.1

License

ISC

Last publish

Collaborators

  • vigour-io