Example showing how to use a counter to limit only a certain number of users to a certain treatment
This project demonstrates how to integrate Split.io feature flags with a a counter based upon a backend datasource
- Node.js and npm installed on your machine
- A Split.io account with a valid SDK key
-
Clone this repository:
git clone https://github.com/split-community/example-splitio-counter.git cd example-splitio-counter -
Install dependencies with
npm install -
Configure your Split.io SDK key: Replace
SDK_KEYin index.js with your actual Split.io SDK key.
- Create a feature flag called
flag_only_show_to_10 - Ensure that it has a
countattribute to showonto any count less than or equal to 10, andoffotherwise 
- Start the express server with
npm start - Open your web browser and visit http://localhost:3000/ to see the application in action.
- As you refresh the page, a new random userid will be generated
- The first 10 users to hit the page will get
on, and anyone else will getoff 