Skip to content

Tggl/openfeature-provider-server-js

Repository files navigation

Tggl Logo

Tggl OpenFeature Javascript Server Provider

The Typescript OpenFeature Provider to evaluate flags and report usage to the Tggl API or a proxy.

🔗 Website📚 Documentation📦 NPM🎥 Videos

Usage

Install the dependencies:

npm i @openfeature/server-sdk openfeature-server-tggl-provider

Start evaluating flags:

import { OpenFeature } from '@openfeature/server-sdk';
import { TgglServerProvider } from 'openfeature-server-tggl-provider'

await OpenFeature.setProviderAndWait(new TgglServerProvider('API_KEY'))

const client = OpenFeature.getClient();

const value = await client.getBooleanValue(
  'my-feature',
  false,
  { userId: 'foo' }
)

if (value) {
  console.log('Feature is enabled')
}