Related:
See the setup guide for more information.
See the API documentation on how to create this actor.
import { Hono } from "hono"; import { upgradeWebSocket } from "hono/deno"; import { assertExists } from "@std/assert"; // Start server export default { async start(ctx) { // Start basic HTTP server const app = new Hono(); app.get("/kv-test", (c) => { // Access the KV API await ctx.kv.put("foo", "bar"); return c.text("done"); }); // Find port const portEnv = Deno.env.get("PORT_HTTP"); assertExists(portEnv, "missing PORT_HTTP"); const port = Number.parseInt(portEnv); // Start server console.log(`Listening on port ${port}`); const server = Deno.serve({ port }, app.fetch); await server.finished; }, };
Add Package
deno add jsr:@rivet-gg/actor-core
Import symbol
import * as actor_core from "@rivet-gg/actor-core";
---- OR ----
Import directly with a jsr specifier
import * as actor_core from "jsr:@rivet-gg/actor-core";