Skip to content

Commit ab65828

Browse files
MellowYarkerelithrar
authored andcommitted
Add wrangler.toml files to DO examples (#17232)
* Add wrangler toml to in-memory example * Add wrangler toml to alarm example * Add `wrangler.toml` title to tile
1 parent 0f0eaef commit ab65828

File tree

5 files changed

+31
-3
lines changed

5 files changed

+31
-3
lines changed

src/content/docs/durable-objects/examples/alarms-api.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,17 @@ export class Batcher {
6969
```
7070

7171
The `alarm()` handler will be called once every 10 seconds. If an unexpected error terminates the Durable Object, the `alarm()` handler will be re-instantiated on another machine. Following a short delay, the `alarm()` handler will run from the beginning on the other machine.
72+
73+
Finally, configure your `wrangler.toml` file to include a Durable Object [binding](/durable-objects/get-started/#5-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
74+
75+
```toml title="wrangler.toml"
76+
name = "durable-object-alarm"
77+
78+
[[durable_objects.bindings]]
79+
name = "BATCHER"
80+
class_name = "Batcher"
81+
82+
[[migrations]]
83+
tag = "v1"
84+
new_classes = ["Batcher"]
85+
```

src/content/docs/durable-objects/examples/build-a-counter.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export class Counter extends DurableObject {
172172

173173
Finally, configure your `wrangler.toml` file to include a Durable Object [binding](/durable-objects/get-started/#5-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
174174

175-
```toml
175+
```toml title="wrangler.toml"
176176
name = "my-counter"
177177

178178
[[durable_objects.bindings]]

src/content/docs/durable-objects/examples/durable-object-in-memory-state.mdx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,17 @@ New Location: ${request.cf.city}`);
6565
}
6666
}
6767
```
68+
69+
Finally, configure your `wrangler.toml` file to include a Durable Object [binding](/durable-objects/get-started/#5-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
70+
71+
```toml title="wrangler.toml"
72+
name = "durable-object-in-memory-state"
73+
74+
[[durable_objects.bindings]]
75+
name = "LOCATION"
76+
class_name = "Location"
77+
78+
[[migrations]]
79+
tag = "v1"
80+
new_classes = ["Location"]
81+
```

src/content/docs/durable-objects/examples/websocket-hibernation-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export class WebSocketHibernationServer extends DurableObject {
179179

180180
Finally, configure your `wrangler.toml` file to include a Durable Object [binding](/durable-objects/get-started/#5-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
181181

182-
```toml
182+
```toml title="wrangler.toml"
183183
name = "websocket-hibernation-server"
184184

185185
[[durable_objects.bindings]]

src/content/docs/durable-objects/examples/websocket-server.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ export class WebSocketServer extends DurableObject {
189189

190190
Finally, configure your `wrangler.toml` file to include a Durable Object [binding](/durable-objects/get-started/#5-configure-durable-object-bindings) and [migration](/durable-objects/reference/durable-objects-migrations/) based on the namespace and class name chosen previously.
191191

192-
```toml
192+
```toml title="wrangler.toml"
193193
name = "websocket-server"
194194

195195
[[durable_objects.bindings]]

0 commit comments

Comments
 (0)