17 lines
No EOL
364 B
TypeScript
17 lines
No EOL
364 B
TypeScript
import { initTRPC } from "@trpc/server"
|
|
import type { Response } from "express"
|
|
import superjson from "superjson"
|
|
|
|
export interface Context {
|
|
res?: Response
|
|
}
|
|
|
|
export async function createContext(res: Response | undefined): Promise<Context> {
|
|
return {
|
|
res
|
|
}
|
|
}
|
|
|
|
export const t = initTRPC.context<Context>().create({
|
|
transformer: superjson
|
|
}) |