Class ApiXConfig

An object that represents the configuration of the API. By default, configuration files are expected to be named apix.config.json.

A typical config file will look like this:

{
"host": "127.0.0.1",
"port": 3000,
"maxRequestAge": 60000
}

Constructors

  • Creates a new configuration object.

    Parameters

    • configFile: string = 'apix.config.json'

      The path to the configuration file. Defaults to apix.config.json.

    Returns ApiXConfig

Methods

  • Retrieves a value for a key.

    Type Parameters

    • T

    Parameters

    • value: T

      the value to set for the key.

    • key: string

      key in config.

    Returns void

  • Retrieves a value for a key.

    Type Parameters

    • T

    Parameters

    • key: string

      key in config.

    Returns undefined | T

    value for provided key.

    const port = config.valueForKey<number>(ApiXConfigKey.Port) || 3000;