import { PrismaClient } from '@prisma/client' ; import * as trpc from '@trpc/server' ; import * as trpcNext from '@trpc/server/adapters/next' ; const prisma = new PrismaClient ( { log : process . env . NODE_ENV === 'development' ? [ 'query' , 'error' , 'warn' ] : [ 'error' ] , } ) ; link export const createContext = async ( { req , res , } ) => { return { req , res , prisma , } ; } ; export type Context = trpc . inferAsyncReturnType < typeof createContext > ;