- cross-posted to:
- programmerhumor@lemmy.ml
- cross-posted to:
- programmerhumor@lemmy.ml
I am thankful I’ve never seen this (or at least, have not seen it yet).
I have however seen plenty of “app” style webpages over the years, but for a lot of them it makes sense, good examples would be Gmail and web based communication programs (discord in the browser as an example). They have to load a bunch of JavaScript and other resources to function.
Discord I get because it’s real time chat. Gmail I get less so, it has some real time chat stuff but the core functionality could be done with far less JS IMO. Maybe I just feel that way because I’m a JS minimalist. Unless the website’s core function needs JS(real time chat etc) I’m a firm believer you should be able to disable JS and the website should not break.
It’s easier to just make one static web app that makes API calls so that’s what’s done.
Is that really easier than just responding to clicking things server side? Again I fully understand there are some use cases where that’s just not possible but in my, admittedly limited, web development experience you can get a whole heck of a lot done server side with no JS at all
At scale, it can be considerably cheaper.
Limit data access according to security policy and some basic filtering from the request. It’s not a huge amount of processing for an API server to do.
Web pages, desktop app, mobile apps, other servers can all use it to access the data.
Template rendering is then done on the client side. So processing for that is done on the client, saving a lot of compute cost - meaning the servers can respond to more API requests.
Data transferred is lower as well. A template that gets populated by the client using data from an API request will be overall smaller than the full template rendered server side.
The client apps can then be entirely managed separately from the server apps, without having to be tightly integrated. This allows the front end team to do what they want, and the backend team do what they want - as long as the API endpoints are correct.For most things, an SPA isn’t required or even desirable (which is why server side rendering of SPAs is a thing).
But SPAs should give a better experience to users, and can be easier to build.That’s interesting, I suppose there are advantages to that. I personally believe those advantages don’t outweigh the downsides of forcing users to run code in their browsers but that’s an interesting perspective.