Socket
Socket
Sign inDemoInstall

@launchdarkly/node-server-sdk

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchdarkly/node-server-sdk

LaunchDarkly Server-Side SDK for Node.js


Version published
Weekly downloads
398K
decreased by-15.74%
Maintainers
1
Weekly downloads
 
Created

What is @launchdarkly/node-server-sdk?

@launchdarkly/node-server-sdk is a feature flag management tool that allows developers to control the release of features to users. It provides a way to manage feature flags, perform A/B testing, and roll out new features gradually.

What are @launchdarkly/node-server-sdk's main functionalities?

Initialize the SDK

This code initializes the LaunchDarkly client with your SDK key and waits for the client to be fully initialized before proceeding.

const LaunchDarkly = require('@launchdarkly/node-server-sdk');
const client = LaunchDarkly.init('YOUR_SDK_KEY');
client.waitForInitialization().then(() => {
  console.log('LaunchDarkly client initialized');
});

Evaluate a feature flag

This code evaluates a feature flag for a given user and returns the flag's value. It allows you to control feature access on a per-user basis.

const user = { key: 'user-key' };
client.variation('your-feature-flag-key', user, false).then((flagValue) => {
  if (flagValue) {
    console.log('Feature is enabled for this user');
  } else {
    console.log('Feature is disabled for this user');
  }
});

Track custom events

This code tracks custom events, which can be useful for analytics and understanding user behavior.

client.track('custom-event-key', user, { customData: 'value' });

Close the client

This code gracefully shuts down the LaunchDarkly client, ensuring that all pending events are sent before closing.

client.close().then(() => {
  console.log('LaunchDarkly client closed');
});

Other packages similar to @launchdarkly/node-server-sdk

Keywords

FAQs

Package last updated on 31 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc