feld on Nostr: > Not really. At least, if you contort a REST API to do what GraphQL can do, it loses ...
> Not really. At least, if you contort a REST API to do what GraphQL can do, it loses the advantages of REST APIs. The singular advantage of a REST API is that they are highly cacheable.
How do you mean? Design the REST API to allow specifying what fields you want returned, and make it do that. The caching proxy should include the POST parameters when caching the unique response. I could do this with Varnish pretty easily.
Published at
2023-07-10 17:57:11Event JSON
{
"id": "d00b6abf6ea21469b9100f12623129607c3e69ab9a222648a4cfc89657adb351",
"pubkey": "262d5a8a8201b6e0804087a9d26929935c7ac6682875b13fe24a5314a04a6cbf",
"created_at": 1689011831,
"kind": 1,
"tags": [
[
"p",
"5f01776c0691515e825871d13aaafc46d807201cb4332c0d7112c3386ffb2e24",
"wss://relay.mostr.pub"
],
[
"p",
"79c2cae114ea28a981e7559b4fe7854a473521a8d22a66bbab9fa248eb820ff6",
"wss://relay.mostr.pub"
],
[
"e",
"8236a7c589bbee09af8670cdb1fbe95c3ba2e99e657899c10ac82b04a386b25f",
"wss://relay.mostr.pub",
"reply"
],
[
"mostr",
"https://bikeshed.party/objects/c55f00f4-4f31-44b8-94af-3acd3088f08e"
]
],
"content": "\u003e Not really. At least, if you contort a REST API to do what GraphQL can do, it loses the advantages of REST APIs. The singular advantage of a REST API is that they are highly cacheable. \n\nHow do you mean? Design the REST API to allow specifying what fields you want returned, and make it do that. The caching proxy should include the POST parameters when caching the unique response. I could do this with Varnish pretty easily.",
"sig": "508058c15bfe2d78c5c25d687d25fc39db4838506eb74a22c30ccb81ad96e8c940cb1c0c13de46c44efe98e78d7330d4eef5d68750d6fc18a8870e51219330c9"
}