Skip to content

Commit 0b0d42c

Browse files
updated readme file with host and region support document (#302)
* updated readme file with host and region support document * remove commented line
1 parent 407b80a commit 0b0d42c

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

README.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,63 @@ You will need to specify the API key, Delivery Token, and Environment Name of yo
6666

6767
Once you have initialized the SDK, you can start getting content in your app.
6868

69+
#### Region and Host Configuration
70+
71+
The SDK supports region and custom host configuration to connect to different Contentstack data centers or custom endpoints.
72+
73+
**Region Support**
74+
75+
You can specify a region to connect to the appropriate Contentstack data center. Available regions are:
76+
- `US` (default) - Uses `cdn.contentstack.io`
77+
- `EU` - Uses `eu-cdn.contentstack.com`
78+
- `AU` - Uses `au-cdn.contentstack.com`
79+
- `AZURE_NA` - Uses `azure-na-cdn.contentstack.com`
80+
- `AZURE_EU` - Uses `azure-eu-cdn.contentstack.com`
81+
- `GCP_NA` - Uses `gcp-na-cdn.contentstack.com`
82+
- `GCP_EU` - Uses `gcp-eu-cdn.contentstack.com`
83+
84+
```typescript
85+
import contentstack, { Region } from '@contentstack/delivery-sdk'
86+
87+
// Using region enum
88+
const stack = contentstack.stack({
89+
apiKey: "apiKey",
90+
deliveryToken: "deliveryToken",
91+
environment: "environment",
92+
region: Region.EU
93+
});
94+
95+
// Using region string
96+
const stack = contentstack.stack({
97+
apiKey: "apiKey",
98+
deliveryToken: "deliveryToken",
99+
environment: "environment",
100+
region: "eu"
101+
});
102+
```
103+
104+
**Custom Host Support**
105+
106+
You can specify a custom host to connect to a custom endpoint. If a custom host is provided, it takes priority over the region-based host.
107+
108+
```typescript
109+
const stack = contentstack.stack({
110+
apiKey: "apiKey",
111+
deliveryToken: "deliveryToken",
112+
environment: "environment",
113+
host: "custom-cdn.example.com"
114+
});
115+
116+
// Custom host with region (host takes priority)
117+
const stack = contentstack.stack({
118+
apiKey: "apiKey",
119+
deliveryToken: "deliveryToken",
120+
environment: "environment",
121+
region: Region.EU,
122+
host: "custom-cdn.example.com"
123+
});
124+
```
125+
69126
#### Querying content from your stack
70127

71128
To get a single entry, you need to specify the content type as well as the ID of the entry.

0 commit comments

Comments
 (0)