41 lines
1002 B
TypeScript
41 lines
1002 B
TypeScript
/**
|
|
* 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/v10/router
|
|
* @see https://trpc.io/docs/v10/procedures
|
|
*/
|
|
|
|
import type { Context } from './context';
|
|
import { initTRPC } from '@trpc/server';
|
|
import SuperJSON from 'superjson';
|
|
|
|
export const t = initTRPC.context<Context>().create({
|
|
/**
|
|
* @see https://trpc.io/docs/v10/error-formatting
|
|
*/
|
|
errorFormatter({ shape }) {
|
|
return shape;
|
|
},
|
|
|
|
/**
|
|
* @see https://trpc.io/docs/v10/data-transformers
|
|
*/
|
|
transformer: SuperJSON,
|
|
});
|
|
|
|
/**
|
|
* Create a router
|
|
*
|
|
* @see https://trpc.io/docs/v10/router
|
|
*/
|
|
export const router = t.router;
|
|
|
|
/**
|
|
* @see https://trpc.io/docs/v10/merging-routers
|
|
*/
|
|
export const mergeRouters = t.mergeRouters;
|