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,
}
}
N
Nick384d 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
M
meow384d ago
thanks will take a peek at middleware
More Posts