npm.io
6.0.16 • Published 1 month ago

rox-node

Licence
SEE LICENSE IN LICENSE
Version
6.0.16
Deps
1
Size
337 kB
Vulns
0
Weekly
0

CloudBees Feature Management - Node.js SDK

CloudBees Feature Management is a secure feature management solution for the enterprise.

Accelerate development and minimize the risk of deploying new code with simple to create feature flags, controlled rollouts, advanced target groups & deployment rules.

Getting Started

Please see the detailed instructions in our docs on how to add CloudBees Feature Management to your project.

Documentation

Getting started guide, use cases, examples and videos can be found at CloudBees Feature Management documentation.

About

CloudBees Feature Management JavaScript SDK for Node.js. Define and use simple and advanced feature flags, remote configuration variables, static and computed custom properties in code. Control your application features via CloudBees Feature Management dashboard.

Installation

npm i rox-node --save

Usage

Obtain an application key by registering at CloudBees Unify.

import Rox from 'rox-node';

const appSettingsContainer = {
  shouldShowWelcome: new Rox.Flag(),
  textColor: new Rox.RoxString('black'),
  textSize: new Rox.RoxNumber(12, [18, 24])
};

const onRoxReady = async () => {
  if (appSettingsContainer.shouldShowWelcome.isEnabled()) {
    const color = appSettingsContainer.textColor.getValue();
    const size = appSettingsContainer.textSize.getValue();
    console.log(`Welcome! Color: ${color}, Size: ${size}`);
  }
};

Rox.register('settingsNamespace', appSettingsContainer);
await Rox.setup('<app key>', {
  configurationFetchedHandler: onRoxReady
});

Configure the SDK with different options

Override the default configuration by providing predefined configuration preset for Rox.setup.

For example:

import Rox from 'rox-node';

/*
- roxOptions.distinctId
- roxOptions.version
- roxOptions.configurationFetchedHandler
- roxOptions.fetchIntervalInSec
*/

const roxOptions = {
  distinctId: 'userId123',
  version: '1.0',
  fetchIntervalInSec: 60,
  configurationFetchedHandler: () => {}
};

await Rox.setup('<app key>', roxOptions);

LICENSE

CloudBees Feature Management is free-to-use, proprietary software. Please see the full license (found in LICENSE in this distribution) for details on its license and the licenses of its dependencies.

CloudBees Feature Management Node.js SDK is free-to-use, proprietary software. Please see the full license found under the LICENSE file for more details.

Feedback

Feedback is always welcomed support@cloudbees.com

Keywords