by arbenpurben · 4y ago · 0 comments
For pete’s sake, just let your server serve html. Replace only the parts of the page that need to update… with html. From your server. The poor thing is just sitting there, idling, bored, borderline depressed because it doesn’t get much of chance to do what it is meant to do, which is, you know… serve. “But it serves JSON” … is like buying a Bugatti Veyron, just to park it in your garage and use its exhaust fumes to dry your clothes 6 days of the week, with a 2 minute drive around the block on Sundays.
That is a very creative analogy, but not one I agree with.
My servers should do as little as possible. They should not serve files just for the sake of it, because they have all these shiny serving features.
And I like JSON as it is not as verbose as html and I can directly work with it in javascript. And then update my html where I need it locally.
If you prefer it differently, than this is fine. The web supports many ways.
Why? It’s not like they wear and tear?
Unless you're building at great scale, it's such a negligible difference that it really shouldn't be part of your decision making process, IMHO.
But we don't need complicated frameworks on the server, keeping track of changes in a shadow DOM and updating the real DOM afterwards.
The server will likely just use some html templates in which it will replace some variables with strings and numbers. Easy peasy, both for the server and for the developer.
You do realize this means all the user data has to be sent to the cloud? Which is what we want to escape? Hypermedia was created for bots for discoverability, I don't know why anyone would think this is an user-centric concept.