Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 3148438

Browse files
committed
chore: update cloudflare-workers to new persist schema (#1014)
1 parent 7107d33 commit 3148438

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1647
-1471
lines changed
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

docs/workers/quickstart.mdx renamed to docs/actors/quickstart.mdx

Lines changed: 8 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,16 @@ export const registry = setup({
4141
```ts Hono
4242
import { registry } from "./registry";
4343
import { Hono } from "hono";
44-
import { serve } from "@hono/node-server";
45-
import { createNodeWebSocket } from '@hono/node-ws'
46-
47-
// Setup server
48-
const app = new Hono();
4944

5045
// Start RivetKit
5146
//
5247
// State is stored in memory, this can be configured later
53-
const { injectWebSocket, upgradeWebSocket } = createNodeWebSocket({ app }) // TODO: do this before app
54-
const { client, hono } = registry.run({
55-
getUpgradeWebSocket: () => upgradeWebSocket,
56-
});
48+
const { client, serve } = registry.server();
5749

58-
// Expose RivetKit to the frontend (optional)
59-
app.route("/registry", hono);
50+
// Setup server
51+
const app = new Hono();
6052

53+
// Example endpoint
6154
app.post("/increment/:name", async (c) => {
6255
const name = c.req.param("name");
6356

@@ -68,12 +61,11 @@ app.post("/increment/:name", async (c) => {
6861
return c.text(`New Count: ${newCount}`);
6962
});
7063

71-
serve({ fetch: app.fetch, port: 8080 }, (x) =>
72-
console.log("Listening at http://localhost:8080"),
73-
);
74-
injectWebSocket(server)
64+
// Start server
65+
serve(app);
7566
```
7667

68+
7769
```ts Express.js
7870
TODO
7971
```
@@ -82,33 +74,6 @@ TODO
8274
TODO
8375
```
8476

85-
```ts Hono
86-
import { registry } from "./registry";
87-
import { Hono } from "hono";
88-
89-
// Start RivetKit
90-
//
91-
// State is stored in memory, this can be configured later
92-
const { client, serve } = registry.server();
93-
94-
// Setup server
95-
const app = new Hono();
96-
97-
// Example endpoint
98-
app.post("/increment/:name", async (c) => {
99-
const name = c.req.param("name");
100-
101-
// Communicate with actor
102-
const counter = client.counter.getOrCreate(name);
103-
const newCount = await counter.increment(1);
104-
105-
return c.text(`New Count: ${newCount}`);
106-
});
107-
108-
// Start server
109-
serve(app);
110-
```
111-
11277
TODO: How to serve without registry helper
11378

11479
TODO: Why we need to use our own custom serve fn
@@ -165,7 +130,7 @@ curl -X POST localhost:8080/increment/foo
165130

166131
<Tab title="Rivet">
167132

168-
```json
133+
```json rivet.json
169134
{
170135
"rivetkit": {
171136
"registry": "src/registry.ts",
File renamed without changes.

0 commit comments

Comments
 (0)