0.0.2 • Published 7 years ago

@betterthings/proxy v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
7 years ago

Proxy

npm version

Usage

const fs = require('fs')
const path = require('path')
const startServers = require('@betterthings/proxy')

const config = {
  SKIN_A: {
    port: 9001,
    ssl: {
      cert: fs.readFileSync(path.resolve(__dirname, 'cert.pem')),
      key: fs.readFileSync(path.resolve(__dirname, 'key.pem')),
    },
    proxy: {
      host: 'localhost:5000',
      headers: {
        'X-SKIN': 'A',
      },
    },
  },
  SKIN_B: {
    port: 9002,
    ssl: {
      cert: fs.readFileSync(path.resolve(__dirname, 'cert.pem')),
      key: fs.readFileSync(path.resolve(__dirname, 'key.pem')),
    },
    proxy: {
      host: 'localhost:5000',
      headers: {
        'X-SKIN': 'B',
      },
    },
  },
  DEV_API: {
    port: 9100,
    proxy: {
      host: 'api.dev.example.com',
      auth: {
        user: 'knockknock',
        password: 'whosthere',
      },
    },
  },
}

startServers(config)

Authors

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago