Fireship · @fireship

GraphQL Basics - Build an app with the SpaceX API

Uploaded October 9, 2019 · Length 15:48

GraphQL Basics - Build an app with the SpaceX API

Summary

Learn GraphQL basics by building an app with the SpaceX API, covering queries, types, and mutations.

  • graphql basics
  • space x api
  • graphql queries
  • graphql types
  • graphql mutations
  • apollo client
  • graphql tutorial

Transcript preview

The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.

  1. 0:00

    graph QL a query language for AP is you

  2. 0:03

    define a schema for your data then tell

  3. 0:05

    graph QL how to fetch and supply that

  4. 0:07

    schema and in doing so amazing things

  5. 0:09

    might happen as we'll see in this video

  6. 0:10

    and 9 ignition sequence start in today's

  7. 0:15

    video you'll learn the fundamental

  8. 0:17

    concepts of graph QL by interacting with

  9. 0:19

    the public space X API if you're new

  10. 0:21

    here like and subscribe and I'd like to

  11. 0:23

    give a special thanks to Arjun ulam and

  12. 0:25

    Shelley who is the mastermind behind

  13. 0:26

    this video if you're looking for a graph

  14. 0:28

    QL expert you can find his LinkedIn and

  15. 0:30

    github in the description below let's

  16. 0:32

    start by answering the question of what

  17. 0:34

    is graph QL in the most basic sense it's

  18. 0:36

    a language that allows your front-end

  19. 0:38

    applications to communicate with your

  20. 0:40

    back-end applications a rosetta stone if

  21. 0:42

    you will a consistent way for your

  22. 0:44

    front-end to request data from your

  23. 0:45

    back-end despite any differences in the

  24. 0:47

    underlying programming language for

  25. 0:49

    example you're a mobile application

  26. 0:50

    might need to request a sandwich from

  27. 0:53

    your API it can make that request by

  28. 0:55

    sending a graph QL query the query will

  29. 0:58

    have the same shape that you expect to

  30. 0:59

    receive back from the API as JSON so in

  31. 1:02

    this case we expect a sandwich object

  32. 1:04

    with bread ham and cheese on the server

  33. 1:07

    graph QL also functions as a runtime for

  34. 1:09

    executing queries the server defines

  35. 1:11

    types for the data that's available

  36. 1:13

    there and also resolvers to actually

  37. 1:15

    fetch the data from a database or some

  38. 1:17

    other data source now because everything

  39. 1:19

    on the server is strongly typed we can

  40. 1:21

    get some really amazing tooling with

  41. 1:23

    graph QL to demonstrate this let's head

  42. 1:25

    over to the graph QL Explorer for the

  43. 1:27

    public space X API if you're the

  44. 1:29

    consumer or using the API in your

  45. 1:31

    front-end application you can do

  46. 1:32

    introspection to the backend to see what

  47. 1:34

    data is available there as you can see

  48. 1:36

    here we have a whole bunch of different

  49. 1:38

    checkboxes that represent different

  50. 1:39

    queries we can make to the space X API

  51. 1:42

    in the middle panel we already have an

  52. 1:44

    example graph ul query ready to go now

  53. 1:46

    go ahead and hit the play button to

  54. 1:48

    execute the query and then you'll see on

  55. 1:49

    the right side we get a JSON payload

  56. 1:51

    returned from the server and what you'll

  57. 1:53

    notice is that the properties on this

  58. 1:55

    JSON object are identical to the way we

  59. 1:57

    structured them in our graph QL query

  60. 1:59

    and on top of that everything is