You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Quickstart: Create a JavaScript app with Azure App Configuration
15
15
16
-
In this quickstart, you'll use Azure App Configuration to centralize storage and management of application settings using the [Azure App Configuration JavaScript provider client library](https://github.com/Azure/AppConfiguration-JavaScriptProvider).
16
+
In this quickstart, you use Azure App Configuration to centralize storage and management of application settings using the [Azure App Configuration JavaScript provider client library](https://github.com/Azure/AppConfiguration-JavaScriptProvider).
17
17
18
18
App Configuration provider for JavaScript is built on top of the [Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/appconfiguration/app-configuration) and is designed to be easier to use with richer features.
19
19
It enables access to key-values in App Configuration as a `Map` object.
@@ -36,9 +36,9 @@ Add the following key-values to the App Configuration store. For more informatio
The following examples demonstrate how to retrieve configuration data from Azure App Configuration and utilize it in your application.
64
+
By default, the key-values are loaded as a `Map` object, allowing you to access each key-value using its full key name.
65
+
However, if your application uses configuration objects, you can use the `constructConfigurationObject` helper API that creates a configuration object based on the key-values loaded from Azure App Configuration.
66
66
67
-
async function run() {
68
-
let settings;
67
+
Create a file named *app.js* in the *app-configuration-quickstart* directory and copy the code from each sample.
69
68
70
-
// Sample 1: Connect to Azure App Configuration using a connection string and load all key-values with null label.
71
-
settings = await load(connectionString);
69
+
### Sample 1: Load key-values with default selector
72
70
73
-
// Find the key "message" and print its value.
74
-
console.log(settings.get("message")); // Output: Message from Azure App Configuration
71
+
In this sample, you connect to Azure App Configuration using a connection string and load key-values without specifying advanced options.
72
+
By default, it loads all key-values with no label.
75
73
76
-
// Find the key "app.json" as an object, and print its property "myKey".
### Sample 3: Load key-values and trim prefix from keys
145
+
146
+
In this sample, you load key-values with an option `trimKeyPrefixes`.
147
+
After key-values are loaded, the prefix "app." is trimmed from all keys.
148
+
This is useful when you want to load configurations that are specific to your application by filtering to a certain key prefix, but you don't want your code to carry the prefix every time it accesses the configuration.
1. Set an environment variable named **AZURE_APPCONFIG_CONNECTION_STRING**, and set it to the connection string of your App Configuration store. At the command line, run the following command:
107
185
@@ -137,7 +215,9 @@ In this tutorial, you'll create a Node.js console app and load data from your Ap
0 commit comments