5 ms·
> their initial content should be included in the payload with the initial page load The problem with that is that it pretty much requires you be running node
by deergomoo 5y ago
> their initial content should be included in the payload with the initial page load
The problem with that is that it pretty much requires you be running node on the back end too. If your back end is built with say PHP or Ruby, you’d need to call out to a node process, which is potentially a lot of additional complexity, time, and expertise.
- gpanders 5y agoWhat, why? It’s just HTML, which PHP and Ruby can generate just fine.
- deergomoo 5y agoIf your component is generated by something like React you'd need to be running React on the back end to pre-render the component and have the front end re-hydrate it. Otherwise you'd be trying to implement everything once in JS and once in PHP/Ruby
- midrus 5y agoEven if you are talking about SSR such as how Next.js does it, you wouldn't be spanning processes from your ruby/php application. You would deploy it as a separate application responsible of the frontend, using your ruby/php application as a backend service providing an API. An alternative is to just serve the HTML from your ruby/php and then take over in the frontend, but this is more complex and not worth it in my opinion.
- deergomoo 5y ago> An alternative is to just serve the HTML from your ruby/php and then take over in the frontend This is still incredibly common for apps that are mostly server rendered but use React/Vue etc "sprinkled" through the codebase for more complex bits of UI.