@betterthings/proxydeprecated

simple proxy for local development

Usage no npm install needed!

<script type="module">
  import betterthingsProxy from 'https://cdn.skypack.dev/@betterthings/proxy';
</script>

README

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