/
githubmirror
/
trpc
Обзор
Документация
Войти
/
githubmirror
/
trpc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/next-prisma-starter/src/server/trpc.ts
50 строк
1 KB
Alex / KATT
chore(www): bump docusaurus (#6051)
27 сен 2024, 17:12
Не верифицирован
27 сен 2024, 17:12
f8e8d17
Код
Авторство
О чём код?
/** * This is your entry point to setup the root configuration for tRPC on the server. * - `initTRPC` should only be used once per app. * - We export only the functionality that we use so we can enforce which base procedures should be used * * Learn how to create protected base procedures and other things below: * @see https://trpc.io/docs/v11/router * @see https://trpc.io/docs/v11/procedures */ import { initTRPC } from '@trpc/server'; import { transformer } from '~/utils/transformer'; import type { Context } from './context'; const t = initTRPC.context<Context>().create({ /** * @see https://trpc.io/docs/v11/data-transformers */ transformer, /** * @see https://trpc.io/docs/v11/error-formatting */ errorFormatter({ shape }) { return shape; }, }); /** * Create a router * @see https://trpc.io/docs/v11/router */ export const router = t.router; /** * Create an unprotected procedure * @see https://trpc.io/docs/v11/procedures **/ export const publicProcedure = t.procedure; /** * Merge multiple routers together * @see https://trpc.io/docs/v11/merging-routers */ export const mergeRouters = t.mergeRouters; /** * Create a server-side caller * @see https://trpc.io/docs/v11/server/server-side-calls */ export const createCallerFactory = t.createCallerFactory;