Skip to content

Commit 34e5dba

Browse files
authored
Add CORS and Bundling sections to README-TEMPLATE (Azure#13516)
## What - Add a section on setting up CORS and creating a browser bundle to our template readme. ## Why CORS is one of the first roadblocks a user will encounter when developing a browser application using our SDK. As such, we should provide some help in the form of "here's the basics of configuring CORS support at the service level" in the README. closes Azure#13149
1 parent 03c4fb6 commit 34e5dba

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

sdk/template/template/README-TEMPLATE.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,24 @@ const { DefaultAzureCredential } = require("@azure/identity");
9797
const client = new TextAnalyticsClient("<endpoint>", new DefaultAzureCredential());
9898
```
9999

100+
### JavaScript Bundle
101+
102+
To use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).
103+
104+
### CORS
105+
106+
> note to package authors: If the service supports CORS please use this section to describe how to enable CORS, otherwise delete this section. See an example below from Azure Storage:
107+
108+
You need to set up [Cross-Origin Resource Sharing (CORS)](https://docs.microsoft.com/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) rules for your storage account if you need to develop for browsers. Go to Azure portal and Azure Storage Explorer, find your storage account, create new CORS rules for blob/queue/file/table service(s).
109+
110+
For example, you can create the following CORS settings for local development. But please customize the settings carefully according to your requirements in a production environment.
111+
112+
- Allowed origins: \*
113+
- Allowed verbs: DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT
114+
- Allowed headers: \*
115+
- Exposed headers: \*
116+
- Maximum age (seconds): 86400
117+
100118
## Key concepts
101119

102120
### TextAnalyticsClient

0 commit comments

Comments
 (0)