Skip to content
This repository was archived by the owner on May 30, 2024. It is now read-only.

launchdarkly/node-server-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LaunchDarkly SDK for Node.js

Quick setup

  1. Install the Node.js SDK with npm

     npm install ldclient-node --save 
  2. Require the LaunchDarkly client:

     var LaunchDarkly = require('ldclient-node'); 
  3. Create a new LDClient with your API key:

     ld_client = LaunchDarkly.init("YOUR API KEY") 

Your first feature flag

  1. Create a new feature flag on your dashboard

  2. In your application code, use the feature's key to check wthether the flag is on for each user:

     ld_client.get_flag("your.flag.key", {"key" : "user@test.com"}, false, function(show_feature) { if (show_feature) { # application code to show the feature } else { # the code to run if the feature is off } });