Skip to content

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

Type Parameter
CustomContext

Parameters

ParameterTypeDescription
optionsCreateNetlifyTRPCHandlerOptions<CustomContext, NetlifySDKContext>

Returns

Handler

Example

import { createNetlifyTRPCHandler } from "@netlify/sdk/ui/functions/trpc";
import { appRouter } from "./router.js";
const handler = createNetlifyTRPCHandler({
endpoint: "/api/trpc",
router: appRouter,
});