4 ms·
Interesting idea! However it will be very expensive to store all of this on a CDN. The problem is users will interact with a majority of (get) APIs through a C
by JerryWebb 3y ago
Interesting idea! However it will be very expensive to store all of this on a CDN.
The problem is users will interact with a majority of (get) APIs through a CDN and as developers we should reduce unnecessary data sitting in the CDN because it costs quite alot of money to serve.
For example if a CDN is returning JSON data {name: “Bart”} were only paying for 50 bytes or so of data transfer. BUT if instead we convert this to HTML and serve it, we would be 10x (or more)the data stored on the CDN to serve that data.
I don’t see a strong argument for paying 10x more to serve data as HTML.
- recursivedoubts 3y agohypermedia apis are not good data apis, as I say in the article: https://htmx.org/essays/two-approaches-to-decoupling/#but-that-s-a-terrible-data-api https://htmx.org/essays/two-approaches-to-decoupling/#but-th... > Many people would object that, sure, this hypermedia API may be flexible for our web application, but it makes for a terrible general purpose API. > This is quite true. This hypermedia API is tuned for a specific web application. It would be cumbersome and error-prone to try to download this HTML, parse it and try to extract information from it. This hypermedia API only makes sense as part of a larger hypermedia system, being consumed by a proper hypermedia client.
- rozap 3y agoYou might not need a CDN
- latortuga 3y agoI get what you're saying but you have to follow that logically to the end. 10x or more of what? What does 50 bytes cost over the wire and what is 10x that? Is this really the thing we are worrying about? Is the best argument that HATEOS costs slightly more fractions of a penny than a json API?
- halfcat 3y agoIs a JSON response smaller here? With HTMX I can return the text `Bart` to be swapped into the innerHTML of the appropriate element. With JSON, the actual text is longer, and I need `Content-Type: application/json` and possibly other headers. My initial page load also requires less bandwidth by not loading React. What do you think? Maybe I should just test it.