mirror of
https://github.com/documenso/documenso.git
synced 2025-11-14 00:32:43 +10:00
16 lines
558 B
TypeScript
16 lines
558 B
TypeScript
import { trpcServer } from '@hono/trpc-server';
|
|
|
|
import { createTrpcContext } from '@documenso/trpc/server/context';
|
|
import { appRouter } from '@documenso/trpc/server/router';
|
|
import { handleTrpcRouterError } from '@documenso/trpc/utils/trpc-error-handler';
|
|
|
|
/**
|
|
* Trpc server for internal routes like /api/trpc/*
|
|
*/
|
|
export const reactRouterTrpcServer = trpcServer({
|
|
router: appRouter,
|
|
endpoint: '/api/trpc',
|
|
createContext: async (_, c) => createTrpcContext({ c, requestSource: 'app' }),
|
|
onError: (opts) => handleTrpcRouterError(opts, 'trpc'),
|
|
});
|