In this video, Emmanuel Henri demonstrates how to pass arguments to a query and how it can be used. As this project connects to an official DB, passing arguments will be important to resolve the right data.
- [Instructor] We rarely do any queries without any…arguments and since resolvers are primarily a function…that returns a result to our query, we can pretty much…do whatever we want, therefore pass arguments to resolve…a query, lets update our schema to take an id of the user…to return so the first thing I want you to do is update…the schema so our friend accepts an id and then doesn't…have a choice to accept an id so what this means here is…unless you put an id this is not going to work, it…needs to have an id then in our server you want to update…the resolver to make sure that it takes that argument…so in this case we're taking the argument so args…and that's pretty much it for this one, save it.…
And make sure you stop your server and rerun it so yarn…start and before we leave VS Code copy the id here,…go in our GraphiQL server, refresh it, and now you see…that there's an error and you see that unless we put…something here it's not going to work, so if we run it…then Oops it's asking for an id so lets go ahead and add…
- Setting up GraphQL
- Running queries
- Updating schema and solvers
- Adding data
- Adding Relay entry components
- Coding GraphQL fragments
Skill Level Advanced
Node.js: Build Your First Microservice (2016)with Daniel Khan2h 9m Intermediate
1. Introduction and Setup
2. GraphQL Development
3. Relay Setup
4. React Integration
Next steps1m 12s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.