createNetlifyTRPCHandler
createNetlifyTRPCHandler<
CustomContext>(options):Handler
createNetlifyTRPCHandler accepts a tRPC router and installs Netlify SDK-specific extensions
onto it.
When using tRPC to build Extension UIs, you must wrap your tRPC router using this function.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
CustomContext |
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options | CreateNetlifyTRPCHandlerOptions<CustomContext> |
Returns
Section titled “Returns”Handler
Example
Section titled “Example”import { createNetlifyTRPCHandler } from "@netlify/sdk/ui/functions/trpc";import { appRouter } from "./router.js";
const handler = createNetlifyTRPCHandler({ endpoint: "/api/trpc", router: appRouter, });