fix missing exports warnings

This commit is contained in:
Robert Soriano
2022-05-18 10:29:13 -07:00
parent af87d87c91
commit 185f222949
5 changed files with 54 additions and 16 deletions

View File

@@ -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)
},
})