
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@launchdarkly/node-server-sdk
Advanced tools
@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.
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');
});
Flagr is another open-source feature flagging and A/B testing tool. It offers a web UI for managing flags and supports complex flag evaluation rules. Like Unleash, Flagr is self-hosted, providing flexibility and control at the cost of additional maintenance.
Split.io is a feature flagging and experimentation platform. It offers robust analytics and targeting capabilities, similar to LaunchDarkly. Split.io is a managed service, which means less maintenance for the user but potentially higher costs.
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.
For using LaunchDarkly in client-side Node.js applications, refer to our Client-side Node.js SDK.
LaunchDarkly is a feature management platform that serves trillions of feature flags daily to help teams build better software, faster. Get started using LaunchDarkly today!
This version of the LaunchDarkly SDK is compatible with Node.js versions 14 and above.
Refer to the SDK reference guide for instructions on getting started with using the SDK.
Read our documentation for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the complete reference guide for this SDK.
The authoritative description of all properties and methods is in the TypeScript documentation.
We run integration tests for all our SDKs using a centralized test harness. This approach gives us the ability to test for consistency across SDKs, as well as test networking behavior in a long-running application. These tests cover each method in the SDK, and verify that event sending, flag evaluation, stream reconnection, and other aspects of the SDK all behave correctly.
We encourage pull requests and other contributions from the community. Check out our contributing guidelines for instructions on how to contribute to this SDK.
FAQs
LaunchDarkly Server-Side SDK for Node.js
The npm package @launchdarkly/node-server-sdk receives a total of 667,709 weekly downloads. As such, @launchdarkly/node-server-sdk popularity was classified as popular.
We found that @launchdarkly/node-server-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.