Code Example

Store a feature toggle as a boolean in Configly

Configly allows the storage of multiple types: string, number, boolean and JSON.

/* Node.JS / JavaScript example */
const { Configly } = require('configly-js');
const configlyClient = Configly.init('Dem0apiKEY');

const getContent = async (text) => {
  const enabled = await configlyClient.get('feature_html_decorate_is_enabled');
  if (enabled) {
    return `<b style="color: red">${content}</b>`;
  }
  return text;
}

In this example, we built an Express app with a remote feature toggle. The toggle enables adding styling to text returned by an endpoint.

The developers can safely deploy this code with the feature disabled and turn it on only when ready.

The toggle can stay in the code. If there is ever a need to revert the feature (such as a bad incident or bug), it can be done near instantly through the flip of a switch.