NextJS integration: How does the NextJS server interact with the embedded GraphQL server when doing a server-side render? #3254
Replies: 1 comment 2 replies
-
So I found this can be achieved through features in the GraphQL client rather than the server. More specifically, Apollo Client allows you to pass in a This solution is quite elegant. It also avoids making calls over The only issue is now you have two ways of serving the GraphQL queries, directly via ApolloClient and remotely via the |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to understand how to create a monolithic NextJS/GraphQL server. I've seen that graphql-yoga integrates well with NextJS and that the GraphQL server can be embedded into a NextJS route. This setup is perfect for client-side rendering (CSR). However, I haven't found much information on what happens during server-side rendering (SSR).
I will play around with this to better understand, but I wanted to ask here first in case others have the same question.
The main question I want to understand is how does the NextJS server interact with the embedded GraphQL server when doing a server-side render?
It seems like there are three options as to where the graphql requests made by the components/pages are routed:
localhost:3000
(small latency)Ideally, I want the third option for the best performance, but also, because I plan to deploy this app on GCP Cloud Functions, I want to avoid unnecessary function calls.
Any help would be appreciated. I will update when I find some answers.
Beta Was this translation helpful? Give feedback.
All reactions