# GraphQL Recap Solution

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

## Scott walks through the solution to the GraphQL Recap Exercise using queries and mutations.

Get Unlimited Access Now

Transcript from the "GraphQL Recap Solution" Lesson

[00:00:00]
>> Scott Moss: All right, so welcome back. Hopefully we have enough time to people to get lost in GraphQL and do some things. Did anybody get to the part where they were making subscriptions? [LAUGH] Anybody make subscriptions? Okay, cool, cuz I didn't ask you to make subscriptions, and if you did, that's awesome.

[00:00:19]
>> Speaker 2: [INAUDIBLE] I've done that before.
>> Scott Moss: [LAUGH] Yeah, cuz we're not gonna be doing subscriptions here, but that's awesome if you did, cuz GraphQL will support subscriptions out the box. Okay, cool, so I'm just gonna walk through, again, just some helloWorld stuff. Walk through kinda like what I did and just get started with this, and then, we'll move on to the next lesson.

[00:00:41] So, as far as kinda like what I did here, I had this helloWorld thing. Actually, let's go look at this right here. So, I just have a basic query. This is simple, but there's some small nuances in here, right? Like, for instance, let me ask you this, if I were to say helloWorld took an argument, and let's say it took a message, and it's typed with String.

[00:01:09] Right, let's say I did that. Then if I go back into the playground, actually, okay, let me go back to the playground. And if I don't pass the argument here, do you expect GraphQL to freak out? No, yes? Who says no? GraphiQL's not gonna freak out, because I don't pass the argument.

[00:01:32] Who says yes? Okay, you can't not be no or yes. It's either yes or no.
>> Speaker 2: What was the query definition, I missed it.
>> Scott Moss: The query definition-
>> Speaker 2: Is bangless, right?
>> Scott Moss: It's just just message: String.
>> Speaker 2: I don't think it'll freak out. I think it'll let it work.

[00:01:50]
>> Scott Moss: Why do you think that?
>> Speaker 2: Because String is not required.
>> Scott Moss: Yeah, exactly, I didn't make it required, so is there a period there? What is that? No, is that just me?
>> Speaker 2: No, I see it.
>> Scott Moss: [LAUGH]
>> Speaker 2: Okay, I'm like, what is that? That's the tab link, okay, yeah, so you can see it's running just fine, because there's no bang.

[00:02:11] But if I do add that thing, and I try to run this, let me refresh. And I try to run this, okay, did it not refresh? Let me restart this.
>> Speaker 2: Okay.
>> Speaker 2: There we go. And you can see it's already like erroring out here, like, you need to add a thing here.

[00:02:40] So that's just like a small nuance, so those non node characters can make a big difference in how people can consume your data, so use them carefully. And we'll see more examples of that. So that's for query, and then for mutation, it's pretty much the same here. Make a mutation, we can call it newAnimal, take some args, call it input, we'll make some inputs here,

[00:03:14]
>> Speaker 2: NewAnimal.
>> Speaker 2: Inputs, and do a name. Cool.
>> Speaker 2: And now, you can do this. Okay, so here's the question now, so knowing what we just find out, now that this newAnimal mutation, it also does not have a bang, but it's input has a field called name that has a bang.

[00:03:45] So will GraphQL freak out if I don't supply an input?
>> Scott Moss: No.
>> Speaker 2: Why is that?
>> Scott Moss: The input's not required, if you provide an input, then you have to provide the name.
>> Speaker 2: That's right, yeah, that's exactly right. Yeah, just wanted to make sure you all are following.

[00:04:01] So yeah, that's exactly right. The input itself is not required, cuz there's no exclamation here, so therefore, I don't need to pass it. But it's a mutation, so if you don't pass an input, then what are you doing? So you kind of have to pass an input on a mutation, otherwise you don't know where you're mutating.

[00:04:17] Cool, any questions on like just getting started with this and how this works? If you took a tour of the repo, and you're just looking at it like what is going on here? I'm also open to answer some of those questions. If you have them, but let's just get started with this next session.

[00:04:34] And then, when I give you a walk through of what you're gonna be doing next, which is gonna be actually utilizing this repo and taking advantage of it, Aand not so much this helloWorld stuff. I can kinda walk through what these different files and different things are doing.

[00:04:45] So you can save them for that part.