pull down to refresh
13 sats \ 3 replies \ @k00b 14 Apr 2022 \ parent \ on: Stacker News Mobile Phone Application (Mock) bitcoin
We have a graphql API which I find superior to either.
Sweet, yeah, i never worked with graphql, so that's great to hear that it works!
reply
It's a 10-100x improvement over REST. You hit one API endpoint with a query that's more or less "I want this data and for it to be shaped like this."
This is how I query for top users.
query TopUsers($cursor: String, $within: String!) { topUsers(cursor: $cursor, within: $within) { users { name amount } cursor } }
This is how I query for posts where
ItemFields
is a reusable query fragment.query items($sub: String, $sort: String, $cursor: String) { items(sub: $sub, sort: $sort, cursor: $cursor) { cursor items { ...ItemFields } } }
reply
Oh, interesting. I have to read up about this
reply