Lois
Lois2y ago

A lot of WHY

Great post from @cje on Twitter but also got a lot of questions 1. If the data flow starts from server/api/routers/examples.ts , why is the create-t3-app documentation starts from pages/api/trpc/[trpc].ts? Is there specific reason for that? Or is it just a big massive loop that has no starts and ends? 2. When you say Next.js hands the request to tRPC, shouldn't it be from pages/[somepage]/*.tsx -> page/api/[someapi] ->server/trpc.ts -> server/trpc/*.tsor some server/db/*.ts? 3. Why do we need utils/api.ts? Why not just define the data flow and React Query Hooks in server/*/*.ts? Why not just import router type and enable superjson in pages/api/*.ts ? 4. When you say Shape of API , what could be the shape of api? You meant the input/output type and types of procedures?
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Lois
Lois2y ago
and you can possibly get some examples in to understand the syntax better
Lois
Lois2y ago
ahah if it starts from useQuery why do you put it at the bottom hahah human visual system starts at 1/3 on a page, the place you put middleware is actually where naturally people would look at first