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