tRPCttRPC
Powered by
Michael SchaufelbergerM
tRPC•3y ago•
11 replies
Michael Schaufelberger

What's the benefit of using the context instead of a direct import for the database connection?

I've wondered why I should use the tRPC context instead of just importing my database singleton from a module. Is there any benefit to it?

Because of TS performance issues, I'm creating multiple functions for bigger procedures. And passing the db connection around may be an unnecessary overhead.
tRPCJoin
Move Fast & Break Nothing. End-to-end typesafe APIs made easy.
5,015Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Any Benefit using tRPC for only remote api calls?
maxpowernzMmaxpowernz / ❓-help
3y ago
What's the type of errorFormatter parameter
AezralAAezral / ❓-help
3y ago
Getting the type of context
TribeTTribe / ❓-help
2y ago
Using generics duplicates the types instead of referring to the existing types
MartinMMartin / ❓-help
3y ago