Rollout.io ROX JS SDK Client for SSR
npm install rox-ssrCloudBees 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.
Please see the detailed instructions in our docs on how to add CloudBees Feature Management to your project.
Getting started guide, use cases, examples and videos can be found at Rollout support site
Rollout JavaScript SSR SDK for web applications that use server side rendering. Define and use simple and advanced feature flags, static and computed custom properties in code. Control your application features via Rollout's dashboard.
npm i rox-ssr --save
`Usage
$3
Obtain an application key by registering at Rollout.io. `javascript
import {RoxString, RoxNumber, Flag, Rox} from 'rox-ssr';const appSettingsContainer = {
shouldShowWelcome: new Flag(),
textColor: new RoxString('red', ['green', 'blue']),
textSize: new RoxNumber(15, [20, 45])
};
const onRoxReady = () => {
if (appSettingsContainer.shouldShowWelcome.isEnabled()) {
const color = appSettingsContainer.textColor.getValue()
const size = appSettingsContainer.textSize.getValue()
const div = document
.createElement('div')
.textContent('Hello world!')
.setAttribute('style',
color: ${color}; font-size: ${size}px) const body = document.getElementsByTagName('body')[0]
body.appendChild(div)
}
};
Rox.register('settingsNamespace', appSettingsContainer);
Rox.setup('', {
configurationFetchedHandler: onRoxReady
});
`$3
In order to ensure the consistency of feature flags between the server and the web clients,
the Rollout configuration can easily be sent to the clients.React example, assuming you already have initialized Rox. Add this to the server-side code, within the
tag:
`javascript
import {Rox} from 'rox-ssr';// ...
// Your component render() method
render() {
return (