This is a node / express app that demonstrates using feature flags via environment variables.
You can set environment variables using .env
file.
To start you can copy the example file as follows:
cp .env.example .env
You can also just export environment variables
export ENABLE_FEATURE_<NAME>=true
Install the node modules:
npm install
There are two features that can be toggled on and off by setting its corresponding environment variable:
Feature | Environment variable name |
---|---|
unicorn | ENABLE_FEATURE_UNICORN |
dragon | ENABLE_FEATURE_DRAGON |
To toggle the feature on or off set the variable to true
or false
and then restart the service.
Start the service with:
npm start
Then you can open the site in your browser at: http://localhost:3000