|
2 | 2 |
|
3 | 3 | [](https://www.npmjs.com/package/@microsoft/feature-management) |
4 | 4 |
|
5 | | -Feature Management is a library for enabling/disabling features at runtime. |
6 | | -Developers can use feature flags in simple use cases like conditional statement to more advanced scenarios like conditionally adding routes. |
| 5 | +Feature management provides a way to develop and expose application functionality based on features. Many applications have special requirements when a new feature is developed such as when the feature should be enabled and under what conditions. This library provides a way to define these relationships, and also integrates into common JavaScript code patterns to make exposing these features possible. |
7 | 6 |
|
8 | 7 | ## Getting Started |
9 | 8 |
|
10 | | -### Prerequisites |
| 9 | +[Azure App Configuration Quickstart](https://learn.microsoft.com/azure/azure-app-configuration/quickstart-feature-flag-javascript): A quickstart guide about how to integrate feature flags from Azure App Configuration into your JavaScript applications. |
11 | 10 |
|
12 | | -- Node.js LTS version |
| 11 | +[Feature Overview](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-overview#feature-development-status): This document provides a feature status overview. |
| 12 | + |
| 13 | +[Feature Reference](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference): This document provides a full feature rundown. |
13 | 14 |
|
14 | 15 | ### Usage |
15 | 16 |
|
16 | | -You can use feature flags from the Azure App Configuration service, local files or any other sources. |
| 17 | +You can use feature flags from the Azure App Configuration service, local files or any other sources. For more information, please go to [Feature flag configuration](https://learn.microsoft.com/azure/azure-app-configuration/feature-management-javascript-reference#feature-flag-configuration). |
17 | 18 |
|
18 | 19 | #### Use feature flags from Azure App Configuration |
19 | 20 |
|
20 | 21 | The App Configuration JavaScript provider provides feature flags in as a `Map` object. |
21 | 22 | A builtin `ConfigurationMapFeatureFlagProvider` helps to load feature flags in this case. |
22 | 23 |
|
23 | 24 | ```js |
24 | | -const appConfig = await load(connectionString, {featureFlagOptions}); // load feature flags from Azure App Configuration service |
| 25 | +import { load } from "@azure/app-configuration-provider"; |
| 26 | +import { FeatureManager, ConfigurationMapFeatureFlagProvider } from "@microsoft/feature-management"; |
| 27 | +const appConfig = await load("<CONNECTION-STRING>", {featureFlagOptions}); // load feature flags from Azure App Configuration service |
25 | 28 | const featureProvider = new ConfigurationMapFeatureFlagProvider(appConfig); |
26 | 29 | const featureManager = new FeatureManager(featureProvider); |
27 | 30 | const isAlphaEnabled = await featureManager.isEnabled("Alpha"); |
@@ -54,13 +57,18 @@ Content of `sample.json`: |
54 | 57 |
|
55 | 58 | Load feature flags from `sample.json` file. |
56 | 59 | ```js |
| 60 | +import { FeatureManager, ConfigurationObjectFeatureFlagProvider } from "@microsoft/feature-management"; |
57 | 61 | const config = JSON.parse(await fs.readFile("path/to/sample.json")); |
58 | 62 | const featureProvider = new ConfigurationObjectFeatureFlagProvider(config); |
59 | 63 | const featureManager = new FeatureManager(featureProvider); |
60 | 64 | const isAlphaEnabled = await featureManager.isEnabled("Alpha"); |
61 | 65 | console.log("Feature Alpha is:", isAlphaEnabled); |
62 | 66 | ``` |
63 | 67 |
|
| 68 | +## Examples |
| 69 | + |
| 70 | +See code snippets under [examples/](./examples/) folder. |
| 71 | + |
64 | 72 | ## Contributing |
65 | 73 |
|
66 | 74 | This project welcomes contributions and suggestions. Most contributions require you to agree to a |
|
0 commit comments