nikfp
nikfp
TtRPC
Created by nikfp on 10/18/2023 in #❓-help
Multiple TRPC endpoints on same API, with discrete clients? Any gotchas?
I'm building a Sveltekit app that has several pages that will need to behave like SPA's. Rather than have one TRPC enpoint in the api routes, I'd like to divide each section of the app into it's own trpc server handler, and be able to call a discrete client for that portion. This would allow separation of concerns for each portion of the app. My plan is the following routes ( and maybe more as the app grows) - /routes/api/estimating/trpc/[...procedures] - /routes/api/scheduling/trpc/[...procedures] - /routes/api/reporting/trpc/[...procedures] On the client I would create a separate client for each server route pointed to the corresponding URL. This would in effect create 3 distinct standalone TRPC servers in the app. Any gotchas with this that anyone can see? Anyone done something like this?
12 replies