1 00:00:00,000 --> 00:00:04,951 [MUSIC] 2 00:00:04,951 --> 00:00:10,210 Hi there, I'm Isaac Lee and welcome to introduction to GraphQL. 3 00:00:10,210 --> 00:00:12,620 In this course, I'll show you a whole new method for 4 00:00:12,620 --> 00:00:14,930 fetching data from your backend. 5 00:00:14,930 --> 00:00:19,310 You'll learn how to request data in the exact shape we wanna get it, make changes 6 00:00:19,310 --> 00:00:23,180 to our data, and use some handy tricks to make our code even more reusable. 7 00:00:24,530 --> 00:00:28,790 GraphQL is composed of two main parts, the query language, 8 00:00:28,790 --> 00:00:32,960 which is used to request data, and the framework that processes these queries. 9 00:00:34,050 --> 00:00:36,890 In this course, we'll be focusing on the query language, 10 00:00:36,890 --> 00:00:39,300 which is the meat of GraphQL. 11 00:00:39,300 --> 00:00:43,520 GraphQL's unique language allows us to specify the exact format 12 00:00:43,520 --> 00:00:44,840 that we want to receive our data in. 13 00:00:46,180 --> 00:00:50,240 Other benefits of GraphQL will include self documenting APIs, 14 00:00:50,240 --> 00:00:54,550 the ability to fetch deeply nested data in a single request and 15 00:00:54,550 --> 00:00:58,120 the ability to mount GraphQL in front of any existing API. 16 00:00:59,380 --> 00:01:03,360 So what exactly do we mean by self documenting API? 17 00:01:03,360 --> 00:01:06,330 This just mean that by looking at the API's schema, 18 00:01:06,330 --> 00:01:10,230 it's easy to understand what the data coming out of it will look like. 19 00:01:11,580 --> 00:01:14,700 Let's take a quick look at an example schema. 20 00:01:14,700 --> 00:01:18,250 As you can see, the schema looks a lot like JSON, 21 00:01:18,250 --> 00:01:20,840 without knowing anything else like GraphQL. 22 00:01:20,840 --> 00:01:24,780 I can guess that this movie object will have an ID field, 23 00:01:24,780 --> 00:01:28,450 a title field, a tagline field, and the studio field. 24 00:01:29,485 --> 00:01:32,940 Since the schema is expressed in a format we're familiar with, 25 00:01:32,940 --> 00:01:36,500 you can easily predict which queries will work and which ones won't. 26 00:01:37,790 --> 00:01:43,040 Building on this concept makes fetching deeply nested data easier than ever. 27 00:01:43,040 --> 00:01:47,230 If we need data that is nested inside of another object, like Studio for 28 00:01:47,230 --> 00:01:50,960 example, we can just look at the schema for the nested object. 29 00:01:50,960 --> 00:01:53,350 Which in this case, is the Studio type. 30 00:01:53,350 --> 00:01:56,910 And right away, we know which fields are available for our response. 31 00:01:58,360 --> 00:02:02,910 Lastly, GraphQL is super flexible as a backend. 32 00:02:02,910 --> 00:02:06,670 When it comes to developing new APIs, you can start from scratch 33 00:02:06,670 --> 00:02:10,420 with a GraphQL server that communicates directly with your database. 34 00:02:10,420 --> 00:02:14,480 However, if you already have an API that's responsible for communicating with 35 00:02:14,480 --> 00:02:18,530 your database, you can just bolt GraphQL right in front of that API. 36 00:02:19,545 --> 00:02:23,250 GraphQL doesn't care where the data comes from which makes it useful for 37 00:02:23,250 --> 00:02:25,800 a wide variety of applications. 38 00:02:25,800 --> 00:02:29,290 We won't be covering how to implement a GraphQL backend in this course. 39 00:02:29,290 --> 00:02:31,145 Just know that when it comes time to, 40 00:02:31,145 --> 00:02:34,560 GraphQL can be implemented in just about any environment.