aryzing
aryzing9mo ago

How to configure context for a standalone server?

Are there any examples out there on how to set up context for a standalone server? The docs do include an example for next , although it doesn't help much in setting one up for a standalone server. How is context set up for a standalone server?
Solution:
Thanks, in the end I found it here, https://trpc.io/docs/server/adapters/standalone#2-configure-the-standalone-server The standalone config docs use the createContext function but don't define it, and the createContext docs define it but don't use it with createHTTPServer, so had to put both doc pages together to figure out how to do it for the standalone server...
Jump to solution
3 Replies
Nick
Nick9mo ago
All adapters work the same here, just implement createContext on the adapter
Tamás Soós
Tamás Soós9mo ago
Maybe you're looking for this and this
Adapters | tRPC
tRPC is not a server on its own, and must therefore be served using other hosts, such as a simple Node.js HTTP Server, Express, or even Next.js. Most tRPC features are the same no matter which backend you choose. Adapters act as the glue between the host system and your tRPC API.
Standalone Adapter | tRPC
tRPC's Standalone Adapter is the simplest way to get a new project working. It's ideal for local development, and for server-based production environments. In essence it's just a wrapper around the standard Node.js HTTP Server with the normal options related to tRPC.
Solution
aryzing
aryzing9mo ago
Thanks, in the end I found it here, https://trpc.io/docs/server/adapters/standalone#2-configure-the-standalone-server The standalone config docs use the createContext function but don't define it, and the createContext docs define it but don't use it with createHTTPServer, so had to put both doc pages together to figure out how to do it for the standalone server
More Posts
Docs hard to follow with so much `next` codeNot having a great experience with the docs. There are many examples that use `next`, making it hardadding information to the QueryKey that is not part of the procedure inputwe have the situation that we have our trpc routes read some specific information from the browsesr How to make typed error responses in the context of a specific query?Each query has a typed (success) response, although it seems all queries have a shared type for the What's the negative code returned in error responses?What's the negative error code returned in errors responses and how is it meant to be used by the clTRPC File as InputHi can someone pls help me: https://stackoverflow.com/questions/77381516/nextjs-trpc-file-as-input`refetchOnWindowFocus` with RSC?Hi. Is there any way to have `refetchOnWindowFocus` work with server components? Seems like it onlyMulti useSubscription with trpc react -query integration failed to find second subusing trpc in nx monorepo, node version is 20 with yarn. backend is using trpc with express integratIs there any easy way to create a Type for a trpc routerI want to publish a set of trpc api client to npm, which will be used by my customer directly. But iTRPC with Nextjs 13 App RouterIm trying to implement TRPC with my already existing Nextjs 13 App to get typesafe API's. I've managSecurity: DDOS attack prevention for open endpoints tRPCSo we are building an application and got multiple trpc endpoints associated with it, some of them a