19 lines
498 B
TypeScript
19 lines
498 B
TypeScript
import { inferAsyncReturnType } from '@trpc/server'
|
|
import type { H3Event } from 'h3'
|
|
|
|
/**
|
|
* Creates context for an incoming request
|
|
* @link https://trpc.io/docs/context
|
|
*/
|
|
export function createContext (_event: H3Event) {
|
|
/**
|
|
* Add any trpc-request context here. E.g., you could add `prisma` like this (if you've added it via sidebase):
|
|
* ```ts
|
|
* return { prisma: _event.context.prisma }
|
|
* ```
|
|
*/
|
|
return {}
|
|
}
|
|
|
|
export type Context = inferAsyncReturnType<typeof createContext>
|