Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "launchdarkly-node-server-sdk"

This is the API reference for the LaunchDarkly Server-Side SDK for Node.js.

In typical usage, you will call init once at startup time to obtain an instance of LDClient, which provides access to all of the SDK's functionality.

For more information, see the SDK reference guide.

Index

Type aliases

LDFlagValue

LDFlagValue: any

The types of values a feature flag can have.

Flags can have any JSON-serializable value.

Functions

FileDataSource

  • Creates an object that allows you to use local files as a source of feature flag state, instead of connecting to LaunchDarkly. This would typically be used in a test environment.

    To use this component, call FileDataSource(options) and store the result in the updateProcessor property of your LaunchDarkly client configuration:

    var dataSource = LaunchDarkly.FileDataSource({ paths: [ myFilePath ] });
    var config = { updateProcessor: dataSource };

    This will cause the client not to connect to LaunchDarkly to get feature flags. The client may still make network connections to send analytics events, unless you have disabled this in your configuration with send_events or offline.

    The format of the data files is described in the SDK Reference Guide on Reading flags from a file.

    Parameters

    • options: FileDataSourceOptions

      Configuration for the data source. You should at least set the paths property.

    Returns object

    An object to put in the updateProcessor property for LDOptions.

RedisFeatureStore

  • RedisFeatureStore(redisOpts?: ClientOpts, cacheTTL?: undefined | number, prefix?: undefined | string, logger?: LDLogger | object): LDFeatureStore
  • Creates a feature store backed by a Redis instance.

    For more details about how and why you can use a persistent feature store, see the SDK Reference Guide.

    Parameters

    • Optional redisOpts: ClientOpts

      Optional configuration parameters to be passed to the redis package.

    • Optional cacheTTL: undefined | number

      The amount of time, in seconds, that recently read or updated items should remain in an in-memory cache. If it is zero, there will be no in-memory caching. The default value is DefaultCacheTTL.

    • Optional prefix: undefined | string

      A string that should be prepended to all Redis keys used by the feature store.

    • Optional logger: LDLogger | object

      A custom logger for warnings and errors, if you are not using the default logger.

    Returns LDFeatureStore

    An object to put in the featureStore property for LDOptions.

init

  • Creates an instance of the LaunchDarkly client.

    The client will begin attempting to connect to LaunchDarkly as soon as it is created. To determine when it is ready to use, call LDClient.waitForInitialization, or register an event listener for the "ready" event using LDClient.on.

    Parameters

    • key: string

      The SDK key.

    • Optional options: LDOptions

      Optional configuration settings.

    Returns LDClient

    The new client instance.

Generated using TypeDoc