Skip to content
tRPC

Partners

Function: fastifyTRPCPlugin()

On this page

fastifyTRPCPlugin<TRouter>(fastify, opts, done): void

Defined in: packages/server/src/adapters/fastify/fastifyTRPCPlugin.ts:68

A Fastify plugin that serves a router over HTTP, and over WebSockets with useWSS.

Type Parameters

Type Parameter
TRouter extends AnyTRPCRouter

Parameters

ParameterType
fastifyFastifyInstance
optsFastifyTRPCPluginOptions<TRouter>
done(err?) => void

Returns

void

Example

server.register(fastifyTRPCPlugin, {
  prefix: '/trpc',
  trpcOptions: { router: appRouter, createContext },
});

See

https://trpc.io/docs/server/adapters/fastify#create-fastify-server