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

### Methods

- activateSecurity
- bespokenServer
- port
- secretKey
- start
- startWithConfig
- stop
- targetDomain
- cloudFunction
- http
- lambda

## Constructors

### constructor

- new BSTProxy(proxyType: ProxyType): BSTProxy

- - Defined in client/bst-proxy.ts:51

  #### Parameters

  - ##### proxyType: ProxyType

  #### Returns BSTProxy

## Properties

### proxyType

proxyType: ProxyType

- Defined in client/bst-proxy.ts:53

## Methods

### activateSecurity

- activateSecurity(): void

- - Defined in client/bst-proxy.ts:119

  Enables security which validates that the secret key is present in query or headers

  #### Returns void

### bespokenServer

- bespokenServer(host: string, port: number): BSTProxy

- - Defined in client/bst-proxy.ts:100

  Specifies the host and port of the bespoken server to connect to

  #### Parameters

  - ##### host: string

  - ##### port: number

  #### Returns BSTProxy

### port

- port(port: number): BSTProxy

- - Defined in client/bst-proxy.ts:127

  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

- - Defined in client/bst-proxy.ts:111

  #### Parameters

  - ##### secretKey: string

  #### Returns BSTProxy

### start

- start(onStarted?: function): void

- - Defined in client/bst-proxy.ts:169

  #### Parameters

  - ##### Optional onStarted: function

    - - (error?: any): void

      - #### Parameters

        - ##### Optional error: any

        #### Returns void

### startWithConfig

- startWithConfig(onStarted?: function): BSTProxy

- - Defined in client/bst-proxy.ts:132

  #### Parameters

  - ##### Optional onStarted: function

    - - (error?: any): void

      - #### Parameters

        - ##### Optional error: any

        #### Returns void

  #### Returns BSTProxy

### stop

- stop(onStopped?: function): void

- - Defined in client/bst-proxy.ts:193

  #### Parameters

  - ##### Optional onStopped: function

    - - (): void

      - #### Returns void

### targetDomain

- targetDomain(host: string): BSTProxy

- - Defined in client/bst-proxy.ts:106

  #### Parameters

  - ##### host: string

  #### Returns BSTProxy

### Static cloudFunction

- cloudFunction(functionFile: string, functionName?: string): BSTProxy

- - Defined in client/bst-proxy.ts:85

  Starts a function proxy with the specified node and cloud function file

  #### Parameters

  - ##### functionFile: string

  - ##### Optional functionName: string

  #### Returns BSTProxy

### Static http

- http(targetPort: number): BSTProxy

- - Defined in client/bst-proxy.ts:60

  Starts an HTTP proxy with specified node and target port

  #### Parameters

  - ##### targetPort: number

  #### Returns BSTProxy

### Static lambda

- lambda(lambdaFile?: string, functionName?: string): BSTProxy

- - Defined in client/bst-proxy.ts:71

  Starts a lambda proxy with the specified node and lambda file

  #### Parameters

  - ##### Optional lambdaFile: string

  - ##### Optional functionName: string

  #### Returns BSTProxy

Generated using TypeDoc