Fireship · @fireship

GraphQL with Apollo Server 2.0

Uploaded June 14, 2018 · Length 9:34

GraphQL with Apollo Server 2.0

Summary

Learn how to build a GraphQL API from scratch using Apollo Server 2.0 and Node.js, with a focus on setting up a backend API and consuming it with Angular.

  • graphql
  • apollo server
  • nodejs
  • typescript
  • firebase
  • firestore
  • graphql api
  • backend development

Transcript preview

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

  1. 0:00

    [Music]

  2. 0:06

    one of the big predictions people are

  3. 0:08

    making in 2018 is that graph QL will

  4. 0:10

    make restful api is obsolete in today's

  5. 0:13

    episode we'll learn how to build a graph

  6. 0:14

    QL API from scratch using Apollo server

  7. 0:17

    2.0 and node KS if you're new here make

  8. 0:20

    sure to LIKE and subscribe and I want to

  9. 0:21

    send a huge thank you out to Arjun

  10. 0:23

    yellow man celli he's the mastermind

  11. 0:25

    behind the code in this video and if you

  12. 0:26

    need a talented developer in Denver he

  13. 0:28

    comes highly recommended so let's kick

  14. 0:30

    things off by talking about graph QL

  15. 0:32

    from a very high level imagine you have

  16. 0:34

    an angular app that communicates with a

  17. 0:36

    bunch of different back-end data sources

  18. 0:38

    traditionally you would do this with

  19. 0:39

    either a REST API or a client-side SDK

  20. 0:42

    when you hit a restful endpoint it's the

  21. 0:44

    server that determines the shape of the

  22. 0:46

    data that gets sent back to the client

  23. 0:48

    what happens is that you'll hit a rest

  24. 0:49

    one point and it will respond with a

  25. 0:51

    bunch of data that you don't know

  26. 0:52

    anything about and that you don't need

  27. 0:54

    graph QL is a query language that solves

  28. 0:56

    this problem by sitting in between your

  29. 0:58

    back-end and front-end it allows the

  30. 1:00

    server to define exactly what data is

  31. 1:02

    available and it allows the client to

  32. 1:04

    only request the data that it actually

  33. 1:06

    needs to provide the user experience

  34. 1:08

    what's really cool is that you can use

  35. 1:10

    it with any back-end data source and

  36. 1:11

    this video will use fire store and set

  37. 1:13

    up a node J a server with Apollo to

  38. 1:15

    deliver the API this video is a two part

  39. 1:18

    series in this first installment we will

  40. 1:20

    set up the back-end API and in the

  41. 1:22

    second part we will use angular to

  42. 1:24

    consume this API from the front end when

  43. 1:27

    you set up a graph QL API it provides

  44. 1:29

    this really nice playground that you can

  45. 1:31

    use to start sending requests and this

  46. 1:33

    just works out of the box what we're

  47. 1:35

    going to do in the code is set up

  48. 1:36

    interfaces that describe the data that's

  49. 1:38

    available on the server this is super

  50. 1:40

    powerful because the client can probe

  51. 1:42

    the backend in advance to find out what

  52. 1:44

    types are available and how they can be

  53. 1:46

    requested this means you get amazing

  54. 1:48

    developer tooling even on a foreign API

  55. 1:50

    because you know exactly what's

  56. 1:52

    available and how it can be requested

  57. 1:54

    you can see here I requested all the

  58. 1:56

    interface names and the ones we're

  59. 1:58

    interested in our tweet and user let's