diff --git a/README.md b/README.md index 36b1f80..c6a93b4 100644 --- a/README.md +++ b/README.md @@ -104,12 +104,13 @@ export const router = trpc The `createContext`-function is called for each incoming request so here you can add contextual information about the calling user from the request object. Learn more about authorization [here](https://trpc.io/docs/authorization). ```ts +// ~/server/trpc/index.ts import * as trpc from '@trpc/server' import type { CompatibilityEvent } from 'h3' import { decodeAndVerifyJwtToken } from '~/somewhere/in/your/app/utils' // The app's context - is generated for each incoming request -export async function createContext(event: CompatibilityEvent) { +export async function createContext({ req }: CompatibilityEvent) { // Create your context based on the request object // Will be available as `ctx` in all your resolvers