UNPKG

create-t3-app-fork

Version:

Create web application with the t3 stack

22 lines (20 loc) 472 B
import { createRouter } from "./context"; import { z } from "zod"; export const exampleRouter = createRouter() .query("hello", { input: z .object({ text: z.string().nullish(), }) .nullish(), resolve({ input }) { return { greeting: `Hello ${input?.text ?? "world"}`, }; }, }) .query("getAll", { async resolve({ ctx }) { return await ctx.prisma.example.findMany(); }, });