2023-09-27 17:56:32 +08:00
|
|
|
import * as trpcExpress from '@trpc/server/adapters/express';
|
2023-09-28 18:01:04 +08:00
|
|
|
import { createContext, router } from './trpc';
|
2023-10-03 15:56:09 +08:00
|
|
|
import { appRouter } from './routers';
|
2023-09-27 17:56:32 +08:00
|
|
|
|
|
|
|
export const trpcExpressMiddleware = trpcExpress.createExpressMiddleware({
|
|
|
|
router: appRouter,
|
|
|
|
createContext,
|
2023-09-27 20:27:46 +08:00
|
|
|
onError: ({ path, error }) => {
|
|
|
|
console.error('Error:', path, error);
|
|
|
|
},
|
2023-09-27 17:56:32 +08:00
|
|
|
});
|