Check out a free preview of the full Advanced GraphQL, v2 course

The "Introduction" Lesson is part of the full, Advanced GraphQL, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Scott Moss explains that the course will mainly cover advanced features of GraphQL APIs, and gives a refresher about the main parts of GraphQL, namely type definitions, resolvers, schema, data sources, queries, and mutations.

Preview
Close

Transcript from the "Introduction" Lesson

[00:00:00]
>> Welcome to Advanced GraphQL V2 here with Frontend Masters. I'm Scott Moss, I'm gonna be your instructor today. For me, GraphQL is a technology that I use every single day. We've used it on the front end, we use it on the back end, I'm using it for years now.

[00:00:16]
I've been helping and watching it advance and it's becoming an integral part of the technology that I love. It's one of my favorite pieces of technology. And I'm really excited about teaching this course because it's basically based on a lot of this stuff that I learned along the way over the few years of using GraphQL.

[00:00:33]
The things I learned the hard way and I'm just going to show you how I get past them and different strategies like that. So if you're interested in becoming really savvy with GraphQL API, this is definitely the course. If you don't have any experience with GraphQL APIs, we're still gonna go over some things that could help you get caught up.

[00:00:51]
But having some experience of what GraphQL is will definitely be helpful for this course. Awesome, so first thing is, get everyone the links to the slides and repos. So the repo that we're gonna be using today is gonna be on GitHub Frontend Masters, Advanced GraphQL V2. So make sure you clone that repo, pull it down in the read me, there's a link to some slides that I'm gonna be using for the course today, follow along with yourself or you can just watch me.

[00:01:18]
And then you'll also be doing work in this repo. There are no dependencies in this repo, other than just having node version greater than equal to six and obviously having kit and that's about it. So we'll just get going with that. All right, so first thing I wanna do is just do a refresher on GraphQL APIs for anyone who hasn't used GraphQL API before or you maybe you have, but it's been a while, or you just need a refresher.

[00:01:46]
We do have an intro to GraphQL API, so you can watch that course. But I'm also just gonna go over a lot of that stuff now. So if you are, i.e considering yourself a GraphQL expert, a lot of this might not be that important to you. I'm just gonna go through it.

[00:02:00]
So what is GraphQL? A spec that describes a declarative query language that your clients can use to ask an API for the exact data they want. This is achieved by creating a strongly typed schema for your API, ultimate flexibility in how your API can resolve data, and client queries validated against your schema.

[00:02:17]
And that's just a made up definition that I came up with. But basically it's describing, you can think of it as like TypeScript for your API or in front of your API. And you can use your clients x for exactly what you want based off those type definitions.

[00:02:32]
And that's basically it. So some of the main parts, we have type definitions, which are basically you describing the different entities that your API can expose via queries and mutations. We have resolvers that are responsible for fetching the data for the fields on the type definitions. We have a schema, which is a combination of type definitions and resolvers.

[00:02:53]
We have data sources which work in tandem with resolvers to fetch data from third party resources like rest servers and databases. Queries are what clients use to read data from your GraphQL server and mutations are what clients use to mutate data on your GraphQL API. Tools and libraries.

[00:03:13]
So graphql-js is Facebook's JavaScript GraphQL implementation of the graphql spec. It's a very handy tool. A lot of people use it. I think a lot of tooling is based off of this underneath. Apollo Server is what we're gonna be using today, which I think is the best serve framework for GraphQL as far as NodeJs goes.

[00:03:34]
We are gonna be taking advantage of that one. Express is a serve framework that's very well known and then Node.js eagle system, never heard of it, it's a really good server, Apollo Server is based on top of that, pretty much everything is based on Express these days as far as servers go in Node.js.

[00:03:50]
GraphQL Playground is an application. So if you've ever used something like swagger, or an interactive documentation Explorer, that's what GraphQL playground is. And we get that for free. We're gonna be using that to explore the API that we're gonna be building out today. Because we don't have a client, this course is purely for API.

[00:04:08]
So GraphQL Playground will be our client. That's how we're going to test out the queries and mutations and all the different things that we're going to be doing today. So, let's build a GraphQL API. So follow along on this. We're just gonna spend like 10-15 minutes building a Hello World API.

[00:04:23]
Just to get a refresher on what a GraphQL API is, ask questions if there's some things you're still hazy on if you've never use it, definitely ask me questions. This is the time because after this, we're gonna go straight in and do some crazy stuff. So let's do that.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now