verani 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,12 @@ bun add verani @cloudflare/actors
|
|
|
30
30
|
|
|
31
31
|
### Server Side (Cloudflare Worker)
|
|
32
32
|
|
|
33
|
+
**Suggested folder structure** (optional, for clarity):
|
|
34
|
+
- `src/actors/chat.actor.ts` - Room definitions
|
|
35
|
+
- `src/index.ts` - Export Durable Object classes
|
|
36
|
+
|
|
33
37
|
```typescript
|
|
38
|
+
// src/actors/chat.actor.ts
|
|
34
39
|
import { defineRoom, createActorHandler } from "verani";
|
|
35
40
|
|
|
36
41
|
// Define your room with lifecycle hooks
|
|
@@ -70,6 +75,15 @@ chatRoom.on("chat.message", (ctx, data) => {
|
|
|
70
75
|
export const ChatRoom = createActorHandler(chatRoom);
|
|
71
76
|
```
|
|
72
77
|
|
|
78
|
+
```typescript
|
|
79
|
+
// src/index.ts
|
|
80
|
+
import { createActorHandler } from "verani";
|
|
81
|
+
import { chatRoom } from "./actors/chat.actor";
|
|
82
|
+
|
|
83
|
+
// Create and export the Durable Object class
|
|
84
|
+
export const ChatRoom = createActorHandler(chatRoom);
|
|
85
|
+
```
|
|
86
|
+
|
|
73
87
|
### Wrangler Configuration
|
|
74
88
|
|
|
75
89
|
**Critical**: Each `defineRoom()` creates a room definition, and `createActorHandler()` converts it into a Durable Object class. This class **must be exported** and **declared in Wrangler configuration**.
|