@flagsio/js-sdk v0.1.5
Table of Contents
Overview
Flagsio is an easy-to-use, real-time feature management platform that helps teams build better software, faster. Get started using Flagsio today!
Getting started
To run any of the example client apps locally follow these steps.
Prerequisites
- npm
npm install npm@latest -g
- Create a free account at https://app.flagsio.com/signup
Installation
- Install the SDK package
npm install @flagsio/js-sdk
- Build
npm run build
Local development
- Clone the repo
git clone https://github.com/flagsio/js-sdk.git
- Install NPM packages
npm install
- Build
npm run build
Usage
Browser Client:
Import SDK
// /browser path contains a polyfilled bundle of the SDK for browsers
import FlagsioSdk from "@flagsio/js-sdk/browser";
Connect once in the entry point of your app
app.js
:
const ENV_ID = 'ENTER YOUR ENVIRONMENT ID';
const API_KEY = 'ENTER YOUR API KEY';
FlagsioSdk.connect(ENV_ID, API_KEY, {
debug: true, // enabling will print logs to the console during runtime
});
Anywhere in your application
const isEnabled = FlagsioSdk.hasFeature("example-feature", false);
if (isEnabled) {
// do something when example feature is enabled
} else {
// do something else
}
NodeJS Client:
Import SDK
// root path contains a bundle of the SDK for NodeJS
import FlagsioSdk from "@flagsio/js-sdk";
Connect once in the entry point of your app
app.js
:
const ENV_ID = 'ENTER YOUR ENVIRONMENT ID';
const API_KEY = 'ENTER YOUR API KEY';
FlagsioSdk.connect(ENV_ID, API_KEY, {
debug: true, // enabling will print logs to the console during runtime
});
Anywhere in your application
const isEnabled = FlagsioSdk.hasFeature("example-feature", false);
if (isEnabled) {
// do something when example feature is enabled
} else {
// do something else
}
For more examples, please refer to the Documentation
Roadmap
- TODO
See the open issues for a full list of proposed features (and known issues).
Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this project better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
See CONTRIBUTING.md for more information on how to contribute to our project.
License
Distributed under the Apache License, Version 2.0 License.See LICENSE.txt for more information.
Contact
Flagsio Team - @FlagsioDotCom - github@flagsio.com
Project Link: https://github.com/flagsio/js-sdk/
Website Link: https://www.flagsio.com/