meow
meow2y ago

Enrich the response object for TRPC endpoint

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,
}
}
2 Replies
Nick
Nick2y ago
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
meow
meowOP2y ago
thanks will take a peek at middleware

Did you find this page helpful?