diff --git a/site/src/content/docs/actors/quickstart/next-js.mdx b/site/src/content/docs/actors/quickstart/next-js.mdx index d60eb435e8..7d0359cc3e 100644 --- a/site/src/content/docs/actors/quickstart/next-js.mdx +++ b/site/src/content/docs/actors/quickstart/next-js.mdx @@ -56,7 +56,8 @@ Create a RivetKit client to connect to your actor: import { createClient, createRivetKit } from "@rivetkit/next-js/client"; import type { registry } from "@/rivet/registry"; -const client = createClient(`${window.location.href}api`, { +const client = createClient({ + endpoint: `${window.location.origin}/api/rivet`, transport: "sse", }); @@ -70,22 +71,12 @@ export const { useActor } = createRivetKit(client); -```ts {{"title":"src/app/api/registry/[...all]/route.ts"}} +```ts {{"title":"src/app/api/rivet/[...all]/route.ts"}} import { toNextHandler } from "@rivetkit/next-js"; import { registry } from "@/rivet/registry"; -const server = registry.start({ - // Use the same base path as the client - // This is important for Next.js to route the API calls correctly - basePath: "/api/registry", - studio: { - // Tell RivetKit Studio where to find RivetKit Registry - defaultEndpoint: "http://localhost:3000/api/registry", - }, -}); - // Export the Next.js handler for the API routes -export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server); +export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry); ``` diff --git a/site/src/content/docs/clients/next-js.mdx b/site/src/content/docs/clients/next-js.mdx index 8cba0282b9..f83f971921 100644 --- a/site/src/content/docs/clients/next-js.mdx +++ b/site/src/content/docs/clients/next-js.mdx @@ -39,7 +39,8 @@ Create a RivetKit client to connect to your actor: import { createClient, createRivetKit } from "@rivetkit/next-js/client"; import type { registry } from "@/rivet/registry"; -const client = createClient(`${window.location.href}api`, { +const client = createClient({ + endpoint: `${window.location.origin}/api/rivet`, transport: "sse", }); diff --git a/site/src/content/docs/integrations/next-js.mdx b/site/src/content/docs/integrations/next-js.mdx index c4e950ec9e..1bd94f3e2c 100644 --- a/site/src/content/docs/integrations/next-js.mdx +++ b/site/src/content/docs/integrations/next-js.mdx @@ -53,22 +53,12 @@ export const registry = setup({ -```ts {{"title":"src/app/api/registry/[...all]/route.ts"}} +```ts {{"title":"src/app/api/rivet/[...all]/route.ts"}} import { toNextHandler } from "@rivetkit/next-js"; import { registry } from "@/rivet/registry"; -const server = registry.start({ - // Use the same base path as the client - // This is important for Next.js to route the API calls correctly - basePath: "/api/registry", - studio: { - // Tell RivetKit Studio where to find RivetKit Registry - defaultEndpoint: "http://localhost:3000/api/registry", - }, -}); - // Export the Next.js handler for the API routes -export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server); +export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry); ``` @@ -94,9 +84,7 @@ const registry = setup({ use: { counter }, }); -const server = registry.start(); - -export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(server); +export const { GET, POST, HEAD, PATCH, OPTIONS } = toNextHandler(registry); ``` #### Parameters