Deepak Sharma
Deepak Sharma
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
sounds great!
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
if you have anytrpc best practices docs or articles please do share with me.
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
thanks Ahmed
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
you mean i can use trpc.product.getDiscount ?
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
import { z } from "zod";

const productsRouter = createTRPCRouter({
get: publicProcedure
.input(z.object({ productId: z.string() }))
.query(async ({ input }) => {
const { productId } = input;
// Fetch product by ID logic here
}),
// Nested router for handling discounts related to a specific product
discount: createTRPCRouter({
get: publicProcedure
.input(z.object({ productId: z.string() }))
.query(async ({ input }) => {
const { productId } = input;
}),
}),
});

export default productsRouter;
import { createTRPCRouter, publicProcedure } from "~/server/api/trpc";
import { z } from "zod";

const productsRouter = createTRPCRouter({
get: publicProcedure
.input(z.object({ productId: z.string() }))
.query(async ({ input }) => {
const { productId } = input;
// Fetch product by ID logic here
}),
// Nested router for handling discounts related to a specific product
discount: createTRPCRouter({
get: publicProcedure
.input(z.object({ productId: z.string() }))
.query(async ({ input }) => {
const { productId } = input;
}),
}),
});

export default productsRouter;
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
like should i nest a router into another ?
16 replies
TtRPC
Created by Deepak Sharma on 8/13/2024 in #❓-help
Nested tRPC procedures.
No description
16 replies