- {{ data }}
+ {{ error }}
diff --git a/playground/server/trpc/index.ts b/playground/server/trpc/index.ts
new file mode 100644
index 0000000..e3e6e9f
--- /dev/null
+++ b/playground/server/trpc/index.ts
@@ -0,0 +1,21 @@
+// ~/server/trpc/index.ts
+import { z } from 'zod'
+import * as trpc from '@trpc/server'
+
+const fakeUsers = [
+ { id: 1, username: 'jcena', name: 'John Cena' },
+ { id: 2, username: 'dbatista', name: 'Dave Batista' },
+ { id: 3, username: 'jbiden', name: 'Joe Biden' },
+]
+
+export const router = trpc
+ .router()
+ .query('getUser', {
+ // validate input with Zod
+ input: z.object({
+ username: z.string().min(5),
+ }),
+ resolve(req) {
+ return fakeUsers.find(i => i.username === req.input.username)
+ },
+ })
diff --git a/recipes/authorization.md b/recipes/authorization.md
index 7bd5acf..ab09f89 100644
--- a/recipes/authorization.md
+++ b/recipes/authorization.md
@@ -68,6 +68,8 @@ export const router = trpc
import * as trpc from '@trpc/server'
import { TRPCError } from '@trpc/server'
+// Merging routers: https://trpc.io/docs/merging-routers
+
export const router = trpc
.router