March 2018
Intermediate to advanced
304 pages
6h 59m
English
There are two ways that a GraphQL user can provide argument values for an argument: as document literals, and as variables.
Using document literals, values are embedded directly inside the GraphQL document. It’s a straightforward approach that works well for static documents. Here’s a query that uses a document literal for the matching argument that we’ve added to retrieve menu items whose names match "reu":
| | { |
| » | menuItems(matching: "reu") { |
| | name |
| | } |
| | } |
Argument values are given after the argument name and a colon (:), and the literal for a :string argument is enclosed in double quotes ("). Let’s use this query in a new test, just as we did in Testing Our Query:
Read now
Unlock full access