awaiting for procedure & logging the response.
Hi, I was wondering if there is a way to handle the return object via the post-middleware's? I know we could do something like, However, I want to access the returned result with an event name & log it. This event name could be returned by the procedure itself as one of the key's of
res
. The problem is I can't access the res
object as it's of type MiddlewareResult
& is the whole request itself that is returned from a procedure's query/mutation. How should I go about solving this? Is there a way I could destruct the data returned from next()
and wrap it in a defined type say something similar to, & fill in the fields with my res
object. log the response to my db & return res.reponse
to my client.1 Reply
tldr; Is it possible for my procedure to act as a middlware & my post middlware as a response? If I'm missing something or if someone has a better approach. I'll greatly appreciate it.
Update: Is it possible to ensure that every procedure returns a defined type of data? Something similar to
.output()
but in a way where I don't need to define it again & again for every procedure.