Skip to content

Commit 5f81509

Browse files
CarmenPopoviciumaxvp
authored andcommitted
[Workers] Use table vs inline table toml syntax for routes (#24452)
1 parent d747275 commit 5f81509

File tree

4 files changed

+44
-34
lines changed

4 files changed

+44
-34
lines changed

src/content/docs/workers/configuration/routing/custom-domains.mdx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ To configure a Custom Domain in your [Wrangler configuration file](/workers/wran
5656
<WranglerConfig>
5757

5858
```toml
59-
routes = [
60-
{ pattern = "shop.example.com", custom_domain = true }
61-
]
59+
[[routes]]
60+
pattern = "shop.example.com"
61+
custom_domain = true
6262
```
6363

6464
</WranglerConfig>
@@ -70,10 +70,13 @@ To configure multiple Custom Domains:
7070
<WranglerConfig>
7171

7272
```toml
73-
routes = [
74-
{ pattern = "shop.example.com", custom_domain = true },
75-
{ pattern = "shop-two.example.com", custom_domain = true }
76-
]
73+
[[routes]]
74+
pattern = "shop.example.com"
75+
custom_domain = true
76+
77+
[[routes]]
78+
pattern = "shop-two.example.com"
79+
custom_domain = true
7780
```
7881

7982
</WranglerConfig>
@@ -167,9 +170,9 @@ To migrate the route `example.com/*` in your [Wrangler configuration file](/work
167170
<WranglerConfig>
168171

169172
```toml
170-
routes = [
171-
{ pattern = "example.com", custom_domain = true }
172-
]
173+
[[routes]]
174+
pattern = "example.com"
175+
custom_domain = true
173176
```
174177

175178
</WranglerConfig>

src/content/docs/workers/configuration/routing/routes.mdx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,15 @@ To configure a route using your [Wrangler configuration file](/workers/wrangler/
5858
<WranglerConfig>
5959

6060
```toml
61-
routes = [
62-
{ pattern = "subdomain.example.com/*", zone_name = "example.com" },
63-
# or
64-
{ pattern = "subdomain.example.com/*", zone_id = "<YOUR_ZONE_ID>" }
65-
]
61+
[[routes]]
62+
pattern = "subdomain.example.com/*"
63+
zone_name = "example.com"
64+
65+
# or
66+
67+
[[routes]]
68+
pattern = "subdomain.example.com/*"
69+
zone_id = "<YOUR_ZONE_ID>"
6670
```
6771

6872
</WranglerConfig>
@@ -76,10 +80,13 @@ To add multiple routes:
7680
<WranglerConfig>
7781

7882
```toml
79-
routes = [
80-
{ pattern = "subdomain.example.com/*", zone_name = "example.com" },
81-
{ pattern = "subdomain-two.example.com/example", zone_id = "<YOUR_ZONE_ID>" }
82-
]
83+
[[routes]]
84+
pattern = "subdomain.example.com/*"
85+
zone_name = "example.com"
86+
87+
[[routes]]
88+
pattern = "subdomain-two.example.com/example"
89+
zone_id = "<YOUR_ZONE_ID>"
8390
```
8491

8592
</WranglerConfig>

src/content/docs/workers/tutorials/deploy-a-realtime-chat-app/index.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ To configure a route in your Wrangler configuration file, add the following to y
5252
<WranglerConfig>
5353

5454
```toml
55-
routes = [
56-
{ pattern = "example.com/about", zone_id = "<YOUR_ZONE_ID>" }
57-
]
55+
[[routes]]
56+
pattern = "example.com/about"
57+
zone_id = "<YOUR_ZONE_ID>"
5858
```
5959

6060
</WranglerConfig>
@@ -66,9 +66,9 @@ To configure a subdomain in your Wrangler configuration file, add the following
6666
<WranglerConfig>
6767

6868
```toml
69-
routes = [
70-
{ pattern = "subdomain.example.com", custom_domain = true }
71-
]
69+
[[routes]]
70+
pattern = "subdomain.example.com"
71+
custom_domain = true
7272
```
7373

7474
</WranglerConfig>

src/content/docs/workers/wrangler/configuration.mdx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ Example:
270270
<WranglerConfig>
271271

272272
```toml title="wrangler.toml"
273-
routes = [
274-
{ pattern = "shop.example.com", custom_domain = true }
275-
]
273+
[[routes]]
274+
pattern = "shop.example.com"
275+
custom_domain = true
276276
```
277277

278278
</WranglerConfig>
@@ -296,9 +296,9 @@ Example:
296296
<WranglerConfig>
297297

298298
```toml title="wrangler.toml"
299-
routes = [
300-
{ pattern = "subdomain.example.com/*", zone_id = "<YOUR_ZONE_ID>" }
301-
]
299+
[[routes]]
300+
pattern = "subdomain.example.com/*"
301+
zone_id = "<YOUR_ZONE_ID>"
302302
```
303303

304304
</WranglerConfig>
@@ -318,9 +318,9 @@ Example:
318318
<WranglerConfig>
319319

320320
```toml title="wrangler.toml"
321-
routes = [
322-
{ pattern = "subdomain.example.com/*", zone_name = "example.com" }
323-
]
321+
[[routes]]
322+
pattern = "subdomain.example.com/*"
323+
zone_name = "example.com"
324324
```
325325

326326
</WranglerConfig>

0 commit comments

Comments
 (0)