🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

tog-node

Package Overview
Dependencies
Maintainers
2
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tog-node

Node JS client library that implements the [Tog specification](https://github.com/escaletech/tog) for feature flags over Redis.

0.4.3
latest
npm
Version published
Weekly downloads
1
-75%
Maintainers
2
Weekly downloads
 
Created
Source

Tog Node.js Client

Node JS client library that implements the Tog specification for feature flags over Redis.

Usage

$ npm install tog-node

For details, see the full API reference.

For using sessions

SessionClient reference

const { SessionClient } = require('tog-node')

const sessions = new SessionClient('redis://127.0.0.1:6379')

// wherever you whish to retrieve a session
const session = await sessions.session('my_app', 'session-123-xyz')

const buttonColor = session.flags['blue-button'] ? 'blue' : 'red'

For managing flags

FlagClient reference

const { FlagClient } = require('tog-node')

const flags = new FlagClient('redis://127.0.0.1:6379')

const allFlags = await flags.listFlags('my_app')

const oneFlag = await flags.getFlag('my_app', 'blue-button')

await flags.saveFlag({
  namespace: 'my_app',
  name: 'blue-button',
  description: 'Makes the call-to-action button blue',
  rollout: [
    { percentage: 30, value: true } // will be `true` for 30% of users
  ]
})

const deleted = await flags.deleteFlag('my_app', 'blue-button')

FAQs

Package last updated on 16 Jun 2021

Did you know?

Socket

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.

Install

Related posts