/
githubmirror
/
trpc
Обзор
Документация
Войти
/
githubmirror
/
trpc
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
examples/fastify-server/src/server/router/routers/api.ts
15 строк
424 B
Alex / KATT
docs: skip exposing `t` + general docs improvements (#2957)
10 окт 2022, 17:12
Не верифицирован
10 окт 2022, 17:12
601b29b
Код
Авторство
О чём код?
import { z } from 'zod'; import { publicProcedure, router } from '../trpc'; export const apiRouter = router({ version: publicProcedure.query(() => { return { version: '0.42.0' }; }), hello: publicProcedure .input(z.object({ username: z.string().nullish() }).nullish()) .query(({ input, ctx }) => { return { text: `hello ${input?.username ?? ctx.user?.name ?? 'world'}`, }; }), });