Sometimes the divide between the backend and frontend leads to massive waste


Sometimes the divide between the backend and frontend leads to massive waste.

Example: I'm looking at a web page that displays 6 numbers. Sounds simple. But, here's how it gets the 6 numbers: It requests an array of 1.2MB (75,000+ lines!) of JSON. 🤯The client iterates over this giant array to generate 6 numbers.

Why? Because these 6 numbers are totals, and there's no endpoint that provides the totals. So the UI developer is fetching 1,000's of rows...to display 6 numbers. 🤮

The solution is simple: Create an endpoint that creates the totals on the server and returns the 6 totals.

View original on X