Tutorial: Enable features on a schedule in a Node.js application
In this tutorial, you use the time window filter to enable a feature on a schedule for a Node.js application.
The example used in this tutorial is based on the Node.js application introduced in the feature management quickstart. Before proceeding further, complete the quickstart to create a Node.js application with a Beta feature flag. Once completed, you must add a time window filter to the Beta feature flag in your App Configuration store.
Prerequisites
Use the time window filter
You've added a time window filter for your Beta feature flag in the prerequisites. Next, you'll use the feature flag with the time window filter in your Node.js application.
When you create a feature manager, the built-in feature filters are automatically added to its feature filter collection.
const fm = new FeatureManager(ffProvider);
Time window filter in action
When you run the application, the configuration provider loads the Beta feature flag from Azure App Configuration. The result of the isEnabled("Beta")
method will be printed to the console. If your current time is earlier than the start time set for the time window filter, the Beta feature flag will be disabled by the time window filter.
You'll see the following console outputs.
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Once the start time has passed, you'll notice that the Beta feature flag is enabled by the time window filter.
You'll see the console outputs change as the Beta is enabled.
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: false
Beta is enabled: true
Beta is enabled: true
Beta is enabled: true
Beta is enabled: true
Next steps
To learn more about the feature filters, continue to the following tutorials.