ConfigCat SDK for node.js
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
media
samples/console
src
test
.gitignore
.npmignore
.travis.yml
DEPLOY.md
LICENSE
README.md
package.json
tsconfig.json

README.md

ConfigCat SDK for Node.js

ConfigCat SDK for Node.js provides easy integration between ConfigCat service and applications using Node.js.

ConfigCat is a feature flag, feature toggle, and configuration management service. That lets you launch new features and change your software configuration remotely without actually (re)deploying code. ConfigCat even helps you do controlled roll-outs like canary releases and blue-green deployments. https://configcat.com

Build Status codecov Known Vulnerabilities License
NPM

Getting Started

1. Install and import package:

via NPM package:

npm i configcat-node
const configcat = require("configcat-node");

2. Log in to ConfigCat Management Console and go to your Project to get your API Key:

API-KEY

3. Create a ConfigCat client instance:

let configCatClient = configcat.createClient("#YOUR-API-KEY#");

We strongly recommend using the ConfigCat Client as a Singleton object in your application.

4. Get your setting value:

configCatClient.getValue("isMyAwesomeFeatureEnabled", false, (value) => {
    if(value) {
        do_the_new_thing();
    } else {
        do_the_old_thing();
    }
});

Getting user specific setting values with Targeting

Using this feature, you will be able to get different setting values for different users in your application by passing a User Object to the getValue() function.

Read more about Targeting here.

configCatClient.getValue("isMyAwesomeFeatureEnabled", false, (value) => {
    if(value) {
        do_the_new_thing();
    } else {
        do_the_old_thing();
    },
    {identifier : "#USER-IDENTIFIER#"}
});

Sample/Demo app

Sample Console App

Polling Modes

The ConfigCat SDK supports 3 different polling mechanisms to acquire the setting values from ConfigCat. After latest setting values are downloaded, they are stored in the internal cache then all requests are served from there. Read more about Polling Modes and how to use them at ConfigCat Docs.

Support

If you need help how to use this SDK feel free to to contact the ConfigCat Staff on https://configcat.com. We're happy to help.

Contributing

Contributions are welcome.

About ConfigCat