10 sats \ 1 reply \ @nout OP 14 Apr 2022 \ parent \ on: Stacker News Mobile Phone Application (Mock) bitcoin
Sweet, yeah, i never worked with graphql, so that's great to hear that it works!
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