3 ms·
The dirty little secret of "RESTful" APIs is that everyone was pretty much generating bespoke responses to every request anyway out of data coming out of a data
by niftich 10y ago
The dirty little secret of "RESTful" APIs is that everyone was pretty much generating bespoke responses to every request anyway out of data coming out of a datastore.
Nobody has static files sitting on a server anymore except for static auxiliary assets (CSS, scripts, fonts) or if you're actually running a website with static content, which is exceedingly rare. Everyone has some kind of request router that parses the URL and the body and figures out what to do next, makes a query to a backing database, then assembles and massages the response to make it look like the mediatype the client expects.
- mediascreen 10y agoUsing a CDN in front of an api is not that uncommon from what I have seen. And with clients basically creating their own queries, I imagine the performance implications will be less predictable than with a more rigid REST API.
- niftich 10y agoFair point. To get better caching, one could: - Canonicalize the query to identify queries that look different but are actually equivalent; use the hash of the canonicalized query as a cache key. You can do this on the edge cache, or on the backend. - Cache more full-bodied resources, where additional fields are present, and perform the filter at evaluation time.