Announcing How To Build a GraphQL API
Mar 04, 2020
With 23 videos, it’s a project-oriented course that covers all of the foundational skills necessary for GraphQL proficiency. You can follow along with Scott as he builds the world’s best kung-fu movie API, or you can pick a topic of your own.
In the tutorial, you’ll learn how server-side GraphQL processes and returns data, then you’ll work your way up to more advanced topics like mutations, subscriptions, and resolvers. In the end, you’ll have a functional API where you can query, add, and subscribe to items.
The rest of this post provides a basic overview of GraphQL and what we’ll be covering in the course. But if you’re ready to get started now, skip the rest and head on over to the tutorial!
What is GraphQL?
GraphQL is an API query language and a runtime that fulfills those queries with your data. To unpack what all of that means, let’s break down a few key terms:
- An Application Programming Interface (API) allows you to access and request data from a certain established source. For example, you could use Twitter’s API to analyze data about how often you tweet.
- A query is the process of asking the server for that data, and a query language defines the syntax of how you ask for it. Query languages standardize the query process, making it so that you and your clients can consistently get the same information when you need it.
By providing both a query language and a runtime, GraphQL allows you to build APIs and put them to work.
Why not just use REST or another API format?
There’s a lot of things that make GraphQL different from its competitors, but the main thing is that it’s super efficient. With GraphQL, you only ask for the data you absolutely need, and you can make more complex requests at one time. The best part is that it always checks the cache for information first before making a request to the source, which means less time and energy spent looking for what you need.
Client vs server: What can I do with GraphQL?
Although this tutorial covers only the server side, it’s still important to realize that GraphQL is a double-edged sword that can be implemented on the client side and the server side.
On the front end, we have our query language. We can ask the client to fetch us different data, which we can then display, change, or organize. It’s all about getting the data and making sure that all of your changes are properly cached.
On the back end, the server is in charge of executing your requests and getting the data from a variety of sources in the most efficient way possible. When you want to do a mutation, for example, the server is what watches for your requests and makes the changes happen.
Getting connected: GraphQL’s powerful partners
GraphQL itself is quite handy, but in this tutorial, we incorporate other technologies and frameworks to maximize what our project can accomplish. The three main tools that we use are:
- Apollo Server as our library. It’s one of the most popular GraphQL clients, and it’s super simple to get up and running.
- MongoDB with mongoose to store and manage our data. MongoDB will help us create a database from which to pull our data, and mongoose is a library that manages relationships between that data.
Get started on the course!
Everything you’ve just read is only the tip of the iceberg when it comes to what GraphQL can do. If you want to learn more about what it is and how to use it, “How to Make a GraphQL API” is the course for you. Check it out now!