diff --git a/docs/sdk/server-side/node-js/index.md b/docs/sdk/server-side/node-js/index.md index 8b72430..8a64962 100644 --- a/docs/sdk/server-side/node-js/index.md +++ b/docs/sdk/server-side/node-js/index.md @@ -49,7 +49,7 @@ Import the Bucketeer SDK into your application code. ```js showLineNumbers -import { initialize } from '@bucketeer/node-server-sdk'; +import { initializeBKTClient, defineBKTConfig } from '@bucketeer/node-server-sdk'; ``` @@ -65,7 +65,7 @@ The SDK supports local and remote evaluations. Configure the SDK config and user configuration. :::info -The **tag** setting is the tag you configure when creating a Feature Flag. It will evaluate all the Feature Flags in the environment when it is not configured.
+The **featureTag** setting is the tag you configure when creating a Feature Flag. It will evaluate all the Feature Flags in the environment when it is not configured.
**We strongly recommend** using tags to speed up the evaluation process and reduce the response latency. ::: @@ -73,11 +73,11 @@ The **tag** setting is the tag you configure when creating a Feature Flag. It wi ```js showLineNumbers -const config = { - host: 'YOUR_API_URL', - token: 'YOUR_API_KEY', - tag: 'YOUR_TAG', -}; +const config = defineBKTConfig({ + apiEndpoint: 'YOUR_API_URL', + apiKey: 'YOUR_API_KEY', + featureTag: 'YOUR_TAG', +}); ``` @@ -89,8 +89,9 @@ const config = { Depending on your use, you may want to change the optional configurations available. -- **pollingIntervalForRegisterEvents** (Default is 1 minute - specify in milliseconds) -- **logger** (Default is `logger.DefaultLogger`) +- **eventsFlushInterval** (Default is 30 seconds - specify in milliseconds) +- **eventsMaxQueueSize** (Default is 50) +- **logger** (Default is `DefaultLogger`) - **enableLocalEvaluation** (Default is false) - **cachePollingInterval** (Default is 1 minute - specify in milliseconds) @@ -106,12 +107,12 @@ To evaluate users on the server side you must create an API Key using the `Clien ```js showLineNumbers - const config = { - host: 'YOUR_API_ENDPOINT', - token:'YOUR_API_KEY', - tag: 'YOUR_FEATURE_TAG', - } - const client = initialize(config); + const config = defineBKTConfig({ + apiEndpoint: 'YOUR_API_ENDPOINT', + apiKey:'YOUR_API_KEY', + featureTag: 'YOUR_FEATURE_TAG', + }); + const client = initializeBKTClient(config); ``` @@ -139,14 +140,14 @@ When initializing the SDK you must enable the local evaluation setting. ```js showLineNumbers - const config = { - host: 'YOUR_API_ENDPOINT', - token:'YOUR_API_KEY', - tag: 'YOUR_FEATURE_TAG', + const config = defineBKTConfig({ + apiEndpoint: 'YOUR_API_ENDPOINT', + apiKey:'YOUR_API_KEY', + featureTag: 'YOUR_FEATURE_TAG', enableLocalEvaluation: true, // <--- Enable the local evaluation cachePollingInterval: 10 * 60000, // <--- Change the default interval if needed - } - const client = initialize(config); + }); + const client = initializeBKTClient(config); ``` @@ -198,13 +199,13 @@ The Bucketeer SDK supports the following variation types. ```js showLineNumbers -getStringVariation(user: User, featureId: string, defaultValue: string): Promise; +stringVariation(user: User, featureId: string, defaultValue: string): Promise; -getBoolVariation(user: User, featureId: string, defaultValue: boolean): Promise; +booleanVariation(user: User, featureId: string, defaultValue: boolean): Promise; -getNumberVariation(user: User, featureId: string, defaultValue: number): Promise; +numberVariation(user: User, featureId: string, defaultValue: number): Promise; -getJsonVariation(user: User, featureId: string, defaultValue: object): Promise; +objectVariation(user: User, featureId: string, defaultValue: BKTValue): Promise; ```