4 ms·
You can do this with PostgReST as well. Something like: GET /user?select=name,photo(url),friend(name) I do not use PostgReST, but created something similar.
by deorder 8y ago
You can do this with PostgReST as well. Something like:
GET /user?select=name,photo(url),friend(name)
I do not use PostgReST, but created something similar.
When I perform the following 3 individual requests after I performed the above request the results can all be retrieved from cache (at the server and/or client side):
GET /user?select=name
GET /user/{name}/photo?select=url
GET /user/{name}/friend?select=name
Even when I do the following (without the photo(url) part) it can now just build it from the cache without hitting the database server:
GET /user?select=name,friend(name)
That is one of the advantages of using ReST. It allows you to utilize and benefit from already existing proven and well defined infrastructure components (the connectors etc.).
GraphQL can be used on top of this as well. I experimented with this once as an alternative to the PostgReST-like syntax.
- hardwaresofton 8y agoSomeone linked to this thing called subZero[0], which seems to be a starter kit that exposes APIs as GraphQL and REST from a Postgres database (it uses postgrest), maybe it's a good example of them working side by side. [0]: http://docs.subzero.cloud/ http://docs.subzero.cloud/