by azangru · 7y ago · 0 comments
Anyway, it’s interesting how they separate the code for fetching data (making it a responsibility of one server) from the code for rendering data (making it a responsibility of another, Node-based, server). Which means that although they re-use the code for components, the code for data fetching logic must get duplicated.
In my experience, the rendering server has a copy of the SPA mounted. I'm not aware of any normal reasons for duplicated fetching logic.
I don't get point 2, if they are to 'hydrate' the react renders in node with data, they have to have a 'fetching' logic in there, the fact that it connects to an 'API' instance makes no difference, the client could use the same connection with same logic client side.
The way I am understanding their blog post, they have a dedicated server (let's call it server1) for api requests, and then a server for rendering (let's call it server2). Server1 does all the fetching logic and then sends the received and appropriately processed json to server2, which needs only to use this data for rendering.