spatie / server-side-rendering

Server side rendering JavaScript in a PHP application
https://sebastiandedeyne.com/posts/2018/server-side-rendering-javascript-from-php
MIT License
602 stars 34 forks source link

What's the point of the library? #55

Closed newhope closed 1 year ago

newhope commented 1 year ago

Sorry if my question is stupid but I couldn't think of any real use-case for the library.

If your SPA is already decoupled (or already designed as SSR friendly from the beginning) to have the app-server.js (or server-entry.js), why don't you directly use NodeJS to act as the SSR server than using a PHP wrapper. It's just introducing another layer of PHP code to maintain.

Otherwise, the frontend developer still needs quite a lot of effort to decouple the SPA to make it SSR friendly, then my previous "if" statement should be true => use NodeJS as SSR server will be better in performance & complexity.

Please enlighten me. Thanks