From 83624e0ca84a3919a65eb751edaa45c710c5db4a Mon Sep 17 00:00:00 2001 From: Robert Soriano Date: Wed, 18 May 2022 07:16:20 -0700 Subject: [PATCH] update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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