mirror of
https://github.com/rjNemo/meal_planner
synced 2026-06-10 20:36:39 +00:00
24 lines
678 B
TypeScript
24 lines
678 B
TypeScript
import type { inferRouterOutputs } from "@trpc/server";
|
|
import { z } from "zod";
|
|
import { privateProcedure, router, mergeRouters } from "../trpc";
|
|
import { recipeRouter } from "./recipes";
|
|
|
|
export const helloRouter = router({
|
|
// hello: publicProcedure
|
|
hello: privateProcedure
|
|
.input(
|
|
z.object({
|
|
text: z.string().nullish(),
|
|
}),
|
|
)
|
|
.query(({ input }) => {
|
|
return {
|
|
greeting: `hello ${input?.text ?? "world"}`,
|
|
};
|
|
}),
|
|
});
|
|
|
|
export const appRouter = mergeRouters(helloRouter, recipeRouter);
|
|
// export type definition of API
|
|
export type AppRouter = typeof appRouter;
|
|
export type RouterOutput = inferRouterOutputs<AppRouter>;
|