GraphQL Tutorial #1 - Introduction to GraphQL

Net Ninja · Beginner ·🔧 Backend Engineering ·8y ago

Key Takeaways

Introduces GraphQL and sets up a full-stack application with Node.js, Apollo, and MongoDB

Full Transcript

hey ninjas and welcome to the graph QL dojo all right then so quite a few people have been asking me to do a graph QL series and my friends I am finally answering the call so in this series we're going to be going for an absolute novice to complete black belts in graph QL both on the server side using node.js and also will be getting a front and perspective on the client side using react too so ideally before you start to train yourselves in the art of graph QL and recommend that you have at least a basic grasp of node.js and possibly even a familiarity with react to now that is not essential my friends because I will walk step-by-step through everything we do in this playlist both on the server side and on the client side too but if you do find yourself scratching your head then I would recommend you check out either my node or react series the links to both of those are gonna be down builder so what exactly is graph QL anyway well basically it's a very powerful query language used to communicate data between a client the browser and a server and it allows us to structure data-driven applications in a much more flexible and efficient way than a restful approach would so imagine that we created some kind of restful api for a website which displays books and authors now to retrieve information about a particular book and display that information on a web page we would probably make an AJAX request to an endpoint which looks something like this forward slash books then forward slash the ID and whatever the book we want to retrieve is now this would bring back some information presumably about that book such as the title genre reviews and the author ID so we could display that information on the page but then if we wanted to display author information about this book as well then typically what we do is grab this author ID and then make another request to a different end points such as forward slash author x' /id to get information about that author such as the name the age biography and a list of book IDs and they correspond to the different books that this author has written okay so already we've made two requests from this page to show book information and author information so this is already getting a little bit inefficient then imagine we also want to display information about each or the book that this author has written now we've already got a list of book IDs right here so what we could do I guess is make subsequent requests to this end point right here for each different book now at this point we could be making three four five or more requests to this end point just to get information about each different book so this is when the chinks in the armor of restful design starts to show now I want you to contrast this to a graphic you our query for the same information which looks something like this so here we have a graph QL query this is what they look like and what we're doing is asking for a book with a particular ID one two three then we want the title genre reviews of that book as well as the author and from the author we want the name the bio and the list of books and from each book we just want the name of that book so all of this right here is just one request in graph QL and we're getting back all of that information and all of that related nested information from this one single HTTP request rather than sending four five six or several requests to get that information using restful design now this my friends is freaking awesome and is one of the many reasons that I love graph QL so much that's not all what's more if you don't want all of this information and you just want some of that information from each different thing then you can be selective as to what you want returned to you for example we could say we just want the title of the book the name of the author and the name of the books that that author has written and we don't need to block the return of this request with all these different information such as the genre the reviews the bio that we don't really want so this is another great thing about Kewell and will see all of this in action as we go along through this series alright then guys so in this series what we'll be doing is creating from scratch a graph QL server using node J s and we'll be querying that graph QL server from the front end so to do that we'll be creating a react app to run in the browser which is then going to query that graph QL server and retrieve information from it so if we click on a book over here we're gonna see information about the book the author and the different books by the author as well so this is using graticule behind the scenes to query that information from the graph QL server and retrieve it back here we can also add data by filling out this form down below so the book name the genre and the author if we click Add it's gonna pop it on the screen we could click on this and we can see information about that book and all the different books by that author as well so this is pretty cool we're adding information and we're also retrieving information from the graph QL server so in essence here what we're doing is creating a mini full stack application centered around this whole idea of graph QL with react on the front end and node on the back end now before we get started creating that I just want to make sure that you have node.js installed on your computer either of these versions will do right here and you can find it at no js' dodd the link is gonna be down below secondly i'm using a text editor called atom a lot of people always ask me which one musing it is this because it's freaking awesome and free so download that if you wish I implore you to do so I'm also going to be using a tool called CMD R or Commander I still don't know how to pronounce this but it is just a console emulator for Windows you don't have to use this you can use command line or whatever console you wish this is the one I'm using and you can find it at a commander or CMD a dotnet the link is also going to be down below now finally I am as always going to be giving you access to all of the course files in this playlist you can find them at this repo right here graph QL playlists on github I'll leave the link down below and if you want to get the hold for lesson 10 for example you need to select it from this branch drop-down go to lesson 10 and you're gonna see a lesson 10 code appear right here so there we go my friends that is your will win introduction to graph you well I really really hope you enjoy this series I've really enjoyed creating it and if you do like the videos please my friends do not forget to share subscribe and like and I'm gonna see you in the very next one

Original Description

Hey gang & welcome to your very first GraphQL tutorial. In this series we'll be creating, from scratch, a full-stack application, including a GraphQL server on Node.js, a React front-end (with Apollo) and MongoDB to store all of our data. DONATE :) - https://www.paypal.me/thenetninja ----- COURSE LINKS: + Course files - https://github.com/iamshaunjp/graphql-playlist + Atom editor - https://atom.io/a + CMDER - http://cmder.net/ + Node Download - https://nodejs.org/en/ ======== Other Tutorials ========= ----- NODE.JS TUTORIALS https://www.youtube.com/playlist?list=PL4cUxeGkcC9gcy9lrvMJ75z9maRw4byYp ----- MONGODB TUTORIALS https://www.youtube.com/playlist?list=PL4cUxeGkcC9jpvoYriLI0bY8DOgWZfi6u ----- REACT TUTORIALS https://www.youtube.com/playlist?list=PL4cUxeGkcC9i0_2FF-WhtRIfIJ1lXlTZR ----- SUBSCRIBE TO CHANNEL - https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1 ======== Social Links ========== Twitter - @TheNetNinja - https://twitter.com/thenetninjauk Patreon - https://www.patreon.com/thenetninja
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 4 of 60

1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

Related Reads

📰
When `await mutation()` lies: the `{ error }` destructuring that saves your weekend
Learn how to handle errors when using await mutation() to save time and frustration in your coding projects
Dev.to · Michel Faure
📰
Addressing JavaScript Excel Library Flaws: A New Approach to Prevent Data Loss and Ensure Reliability
Learn how to prevent data loss and ensure reliability in JavaScript Excel libraries by addressing existing flaws and adopting a new approach
Dev.to · Pavel Kostromin
📰
Java 26 Is Here, and You Can’t Avoid It Anymore
Java 26 is out, bringing improvements and making Java harder to ignore as an outdated language
Medium · Programming
📰
Breaking the Clipboard: Why Copy-Pasting Across Different OS is Still Painful
Learn why copy-pasting across different OS is still a challenge and how to overcome it
Dev.to · SimpleDrop-Free&Secure File Sharing
Up next
Indian Express Editorial Analysis by Chandan Sharma - 1 JULY 2026 | UPSC Current Affairs 2026
StudyIQ IAS
Watch →