Your task is to create a simple feature flag API. A feature flag is, according to Wikipedia:
A feature toggle (also feature switch, feature flag, feature flipper, conditional feature, etc.) is a technique in software development that attempts to provide an alternative to maintaining multiple source-code branches (known as feature branches), such that a feature can be tested even before it is completed and ready for release. Feature toggle is used to hide, enable or disable the feature during run time. For example, during the development process, a developer can enable the feature for testing and disable it for other users.
Source: https://en.wikipedia.org/wiki/Feature_toggle
For this task, we want to create feature flag to allow us to conduct an A/B test. Each flag document has:
{
"name": "feature_foo", # Name of the feature
"ratio": 0.5, # Percentage of users that should get the feature (50/50 in this case)
"enabledEmails": ["[email protected]"], # List of emails the feature is always enabled for, regardless of other criteria
"includedCountries": ["US"], # List of countries the user must be from, if empty it is enabled for all countries
"excludedCountries": ["GB"], # List of countries the user must not be from
}
Each user has the following information:
{
"email":"[email protected]",
"location":"GB"
}
Given the list of feature flags in features.json
, your task is to create an API endpoint that returns a list of the features that are enabled for a given user’s email and location. The feature flags returned by the API for a given user must always be consistent. A list of example users are included in example_users.json
.
You can use any frameworks/libraries you like. Be sure to include tests and instructions on how to run the project.
Clone this repository and make your commits to that (removing origin and making a new public repository) and send us the link to the repository when you are finished.
This exercise should not take more than 3 hours.
Ideally we'd like to see a plan, any assumptions, implementation code, and your thoughts on what you would do better / add given more time.
If you have any questions you can email [email protected]