minty
Middleware or request lifecycle hook to run after procedure?
Hi,
I am using trpc context to create a database client for an incoming request. My understanding is this runs for every request, which is what I want.
I want to be able to systematically close the databaase client at the end of any TRPC request. Is there any way of doing this? Perhaps with a middleware or request lifecycle hook? I couldn't find any documentation on it.
This is the structure I want:
Thank you!
18 replies