You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We've built a simple console application that demonstrates how LaunchDarkly's SDK works. Below, you'll find the build procedure. For more comprehensive instructions, you can visit your [Quickstart page](https://app.launchdarkly.com/quickstart#/) or the [Node.js (server-side) reference guide](https://docs.launchdarkly.com/sdk/server-side/node-js).
3
+
We've built a simple console application that demonstrates how LaunchDarkly's SDK works.
4
+
5
+
Below, you'll find the build procedure. For more comprehensive instructions, you can visit your [Quickstart page](https://app.launchdarkly.com/quickstart#/) or the [Node.js (server-side) reference guide](https://docs.launchdarkly.com/sdk/server-side/node-js).
4
6
5
7
The LaunchDarkly server-side SDK for Node.js is designed primarily for use in multi-user systems such as web servers and applications. It follows the server-side LaunchDarkly model for multi-user contexts. It is not intended for use in desktop and embedded systems applications.
6
8
7
9
For a sample application demonstrating how to use LaunchDarkly in *client-side* Node.js applications, refer to our [Client-side Node.js SDK sample application](https://github.com/launchdarkly/hello-node-client).
8
10
9
11
## Build instructions
10
12
11
-
1. Install the LaunchDarkly Node.js SDK by running `npm install`
12
-
13
-
2. Edit `index.js` and set the value of `sdkKey` to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, set `featureFlagKey` to the flag key.
13
+
1. Set the environment variable `LAUNCHDARKLY_SERVER_KEY` to your LaunchDarkly SDK key. If there is an existing boolean feature flag in your LaunchDarkly project that you want to evaluate, set `LAUNCHDARKLY_FLAG_KEY` to the flag key; otherwise, a boolean flag of `sample-feature` will be assumed.
14
14
15
-
```js
16
-
constsdkKey="1234567890abcdef";
15
+
```bash
16
+
export LAUNCHDARKLY_SERVER_KEY="1234567890abcdef"
17
+
export LAUNCHDARKLY_FLAG_KEY="my-boolean-flag"
18
+
```
17
19
18
-
constfeatureFlagKey="my-flag";
19
-
```
20
+
2. Install the LaunchDarkly Node.js SDK by running `npm install`
20
21
21
22
3. Run `node index.js`
22
23
23
-
You should receive the message `"Feature flag '<flag key>' is <true/false> for this user"`.
24
+
You should receive the message "The <flagKey> feature flag evaluates to <flagValue>.". The application will run continuously and react to the flag changes in LaunchDarkly.
0 commit comments