T
tRPC

Enrich the response object for TRPC endpoint

Enrich the response object for TRPC endpoint

Mmeow4/12/2023
Currently when I hit a trpc endpoint I get something like:
{
result: {
data: ...
}
}
{
result: {
data: ...
}
}
Is there any way to add more metadata, like:
{
result: {
data: ...
}
meta: {
time: 10ms,
}
}
{
result: {
data: ...
}
meta: {
time: 10ms,
}
}
Nnlucas4/12/2023
This is a fascinating idea You could probably use a middleware and set some additional headers today, probably add extra keys to the result object itself too If you can really flesh out a use case then it would make an interesting feature request
Mmeow4/12/2023
thanks will take a peek at middleware

Looking for more? Join the community!

T
tRPC

Enrich the response object for TRPC endpoint

Join Server
Recommended Posts
Can i fetch tRPC in different project@coco- : I Make a tRPC in my project. Can I use the enpoint api in different project ?Importing AppRouter types from an external repoI've got a production T3 app already in production. I've created a fresh expo app to start building TypeScript type for request object for route handlersSo far I've been writing my routes like: ```typescript export const router = t.router({ helloWorlTyped wrappers for proceduresI have a TRPC client with working queries and mutations. I wanted to create wrapper functions for alAre TRPC server procedures actual endpoints? Meaning can you directly do a `post` request to them?Lets say you have a public procedure called `getHelloWorld`, can you hit it by doing `localhost:3000TRPCClientError - No "query"-procedure on path "user.all"Im using react native expo, prisma, trpc and the postgres database is on railway I have run the follAm I the only one struggling with pnpm + TypeScript monorepo + trpc?Hello all, When using pnpm in a TypeScript monorepo without `node-linker`, I hit those errors: ```tRPC standalone server in monorepoHi, I'm using t3-stack monorepo as my base and I've swapped out NextJS backend for standalone HTTP Codemod to v10 is not modifying any fileHello 👋, I must be super dumb but running `pnpm dlx trpc-v10-migrate-codemod ` in my project isn't No overload matches this call when outputting unionsHello there 👋, I have this simple procedure (we're not fully migrated on v10 yet, using interop):