Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BSTProxy

Exposes the BST proxy command for use.

The proxy creates a tunnel to the Bespoken Proxy server.

To start it a proxy programmatically, simply call:

const proxy = BSTProxy.lambda("index.js").("SECRET_KEY").start(() => {
     // Stuff to do on start
});

To stop, call:

proxy.stop(() => {
    // Stuff to do on stop
    // If being used in unit tests, good to wait for this to ensure resources are properly cleaned up
});

Your secret key can be found in the ~/.bst/config file.

Hierarchy

  • BSTProxy

Index

Constructors

constructor

Properties

proxyType

proxyType: ProxyType

Methods

activateSecurity

  • activateSecurity(): void
  • Enables security which validates that the secret key is present in query or headers

    Returns void

bespokenServer

  • bespokenServer(host: string, port: number): BSTProxy
  • Specifies the host and port of the bespoken server to connect to

    Parameters

    • host: string
    • port: number

    Returns BSTProxy

port

  • Specifies the port the Lambda/Function Server should listen on. Only for proxies with built-in servers.

    Parameters

    • port: number

    Returns BSTProxy

secretKey

  • secretKey(secretKey: string): BSTProxy

start

  • start(onStarted?: function): void
  • Parameters

    • Optional onStarted: function
        • (error?: any): void
        • Parameters

          • Optional error: any

          Returns void

    Returns void

startWithConfig

  • startWithConfig(onStarted?: function): BSTProxy
  • Parameters

    • Optional onStarted: function
        • (error?: any): void
        • Parameters

          • Optional error: any

          Returns void

    Returns BSTProxy

stop

  • stop(onStopped?: function): void

targetDomain

Static cloudFunction

  • cloudFunction(functionFile: string, functionName?: string): BSTProxy
  • Starts a function proxy with the specified node and cloud function file

    Parameters

    • functionFile: string
    • Optional functionName: string

    Returns BSTProxy

Static http

Static lambda

  • lambda(lambdaFile?: string, functionName?: string): BSTProxy
  • Starts a lambda proxy with the specified node and lambda file

    Parameters

    • Optional lambdaFile: string
    • Optional functionName: string

    Returns BSTProxy

Generated using TypeDoc