Advanced GraphQL

Advanced GraphQL GraphQL Recap Exercise


This course has been updated! We now recommend you take the Advanced GraphQL, v2 course.

Check out a free preview of the full Advanced GraphQL course:
The "GraphQL Recap Exercise" Lesson is part of the full, Advanced GraphQL course featured in this preview video. Here's what you'd learn in this lesson:

Scott sets up a basic "Hello, World!" exercise to generate a schema and play with queries and mutations.

Get Unlimited Access Now

Transcript from the "GraphQL Recap Exercise" Lesson

>> Scott: But again, to make sure everybody's on the same page. There's an exercise that I want everyone to do where it's basically gonna be creating a hello world server. So if you go to the repo and you check out lesson-1,
>> Scott: I thought I had it, let me open it.

>> Scott: There we go, okay, yeah, you check out lesson-1, there is a lot of stuff here. Feel free to go look at some of the stuff, but don't mess with, just look at it. But basically, what you're gonna be doing is, there's a folder in source/api/project, and in that folder, there's some files.

[00:00:50] What you're gonna be doing is, inside that project.graphql file and the project.resolver file, you're just gonna do what I just did. You're gonna make whatever query you want, whatever mutation you want. You just need to get something working, everything's already hooked up. You don't have to connect anything to the server, you don't have to figure out how all that stuff works.

[00:01:12] You just need to fill up these two files, the project.graphql file and the project.resolver file. That's all you gotta do, you can put whatever you want there, just get familiar with it. Make some resolvers, make some mutations, make some queries. Once you get that, the command you're gonna run, if you look in the package.json.

[00:01:34] It's gonna be, if they're using yarn, it'll be yarndev, if you're using mpm, it'll be mpmrundev. That'll start you off in dev mode in nodemon, so it's constantly reloading, so you don't have to save. And then you can just go to localhost:5000/docs to open up your graphical instance, and you can see that.

[00:01:52] So I'm just gonna check out my lesson branch so we can see what it will look like
>> Scott: I guess I gotta check out, there we go. So if I were to run the demo, go to 5000,
>> Scott: /docs, all right, so I'm just gonna show you my hello world query.

[00:02:20] Which is basically just hello world, and we can look at the schema. Returns a type called hello world as a message that's a string. And I can just type in message here, run the query, and then I get hello world. So yeah, do something similar to this, do a mutation, do a couple of mutations or a couple queries.

[00:02:39] You don't even need a database, you can do it all in memory, and just get familiar with it. So it is 10:10 now let's take 30 minutes to do this, and then we'll come back and we'll get going.