A
A
Ann20162017-08-15 07:42:01
JavaScript
Ann2016, 2017-08-15 07:42:01

Tell us about GraphQL?

Please tell us about GraphQL and how you prepare it. I got acquainted with the documentation, this thing interested me, but it seems to me that it is very empty. How do you use conditions when sampling, set limits, etc. etc. Please share your knowledge.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladlen Hellsite, 2017-08-15
@Ann2016

I like the Relay approach for pagination . Actually, it doesn’t really differ from other sampling conditions, something like this:

query {
  users(first: 10, order: "id") {
    totalCount,
    edges {
      cursor,
      node {
        id,
        name,
        lastAt,
        avatar {
          original,
          preview
        }
      }
    },
    pageInfo {
      startCursor,
      endCursor,

      hasNextPage,
      hasPreviousPage
    }
  }
}

In this example, we get the first 10 records sorted by id. PageInfo stores information whether there is a next / previous page and cursors that are passed to the before or after parameters.

L
lukoie, 2018-06-28
@lukoie

available here: www.qcode.in/build-api-for-twitter-like-app-using-...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question