Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 26 additions & 25 deletions docs/sdk/server-side/node-js/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Import the Bucketeer SDK into your application code.
<TabItem value="js" label="JavaScript">

```js showLineNumbers
import { initialize } from '@bucketeer/node-server-sdk';
import { initializeBKTClient, defineBKTConfig } from '@bucketeer/node-server-sdk';
```

</TabItem>
Expand All @@ -65,19 +65,19 @@ 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.<br />
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.<br />
**We strongly recommend** using tags to speed up the evaluation process and reduce the response latency.

:::
<Tabs>
<TabItem value="js" label="JavaScript">

```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',
});
```

</TabItem>
Expand All @@ -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)

Expand All @@ -106,12 +107,12 @@ To evaluate users on the server side you must create an API Key using the `Clien
<TabItem value="js" label="JavaScript">

```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);
```

</TabItem>
Expand Down Expand Up @@ -139,14 +140,14 @@ When initializing the SDK you must enable the local evaluation setting.
<TabItem value="js" label="JavaScript">

```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);
```

</TabItem>
Expand Down Expand Up @@ -198,13 +199,13 @@ The Bucketeer SDK supports the following variation types.
<TabItem value="js" label="JavaScript">

```js showLineNumbers
getStringVariation(user: User, featureId: string, defaultValue: string): Promise<string>;
stringVariation(user: User, featureId: string, defaultValue: string): Promise<string>;

getBoolVariation(user: User, featureId: string, defaultValue: boolean): Promise<boolean>;
booleanVariation(user: User, featureId: string, defaultValue: boolean): Promise<boolean>;

getNumberVariation(user: User, featureId: string, defaultValue: number): Promise<number>;
numberVariation(user: User, featureId: string, defaultValue: number): Promise<number>;

getJsonVariation(user: User, featureId: string, defaultValue: object): Promise<object>;
objectVariation(user: User, featureId: string, defaultValue: BKTValue): Promise<BKTValue>;
```

</TabItem>
Expand Down