Udemy
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Hands-on Application Development with GraphQL: 3-in-1
Rating: 3.6 out of 5(13 ratings)
119 students

Hands-on Application Development with GraphQL: 3-in-1

Rapidly build web applications, better RESTful Web Services, as well as create a blog using GraphQL, React, and Relay!
Last updated 8/2018
English

What you'll learn

  • Implement scaling/pagination for a GraphQL API coupled with Relay client.
  • Explore the benefits of using GraphQL for better RESTful web service development.
  • Learn tooling to troubleshoot issues that may occur while using your own or any other GraphQL server.
  • Build complete, effective web apps that interact with a backend via GraphQL queries.
  • Create your own server for your application in GraphQL.
  • Create your own GraphQL API with a blog.
  • Connect prisma/graph .cool as a cloud-based realtime GraphQL database.

Course content

3 sections84 lectures12h 10m total length
  • The Course Overview3:24

    This video provides an overview of the entire course.

  • Introduction to GraphQL3:55

    Introduction to the basic concepts of GraphQL by showing how the queries, response, and the type system look like and in the process, briefly comparing GraphQL to the existing standard REST and covering the benefits of the GraphQL type system.

    • Introduce GraphQL by showing its queries, responses, and type system

    • Show the advantages of having a strong type system

    • Show the GraphQL adoption usage patterns

  • GraphQL Versus REST and Relay Versus Apollo3:54

    Compare GraphQL to the existing data exchange standard REST, discuss why using a GraphQL client is better and compare two of the most popular GraphQL clients Relay and Apollo.

    • Discuss the advantages of GraphQL over REST

    • Show why is it better to use a GraphQL client

    • Compare Relay and Apollo

  • Setting Up the Environment5:27

    Setting up the code environment including frontend and backend to start building the blog.

    • Install create-react-app and build an initial react app

    • Setup the create-react-app environment for relay modern

    • Setup the code environment for backend by installing express and express-graphql

  • Schema and Types Required for a Blog9:05

    Introduce the fundamental building blocks of GraphQL backend including Schema, types, special root types, scalar types before diving in to build a small GraphQL backend.

    • Introduce basics of GraphQL Schema and type system

    • Introduction to GraphQL scalar types

    • Build a basic GraphQL backend

  • Introduction to GraphiQL4:24

    Introduce one of the best tools that you can leverage while building a GraphQL backend and explore its features like documentation explorer, typeahead queries/mutations, code prettifier history and share-ability.

    • Display and explanations of the GraphiQL interface and documentation explorer

    • Explore GraphiQL typeahead queries/mutation and live feedback

    • Explore how GraphiQL persists the IDE state in URL and in inherently shareable

  • Adding Relay Specification to GraphQL Schema3:02

    Discuss the constraints put by Relay on GraphQL backend for it to be compliant including node interface, connections and mutation types.

    • Introduction to fragments and interface in GraphQL

    • Discuss the node interface and GraphQL connections used for pagination

    • Discuss the constraints relay put on mutation type including clubbing of input arguments and response payload specification

  • Queries Backend for a Blog8:11

    Introduce the constraints imposed by Relay on GraphQL backend queries.

    • Discuss the Relay specification for Queries

    • Implement the node interface as a object refetching mechanism

    • Implement connection type which is Relay abstraction over pagination

  • Mutations Backend for a Blog3:09

    Introduce the constraints imposed by Relay on GraphQL backend mutations.

    • Discuss the Relay specification for mutations

    • Implement the input type arguments for mutations

    • Implement the response payload for mutations

  • Impact of Using Relay on Queries and Mutations3:28

    Discuss the impact of complying to the Relay interface on GraphQL backend queries and mutations.

    • Basic discussion of Relay specification impact on backend

    • Explore the code of node definitions in graphql-relay package

    • Explore the code of connection definitions in graphql-relay package

  • Setting Up the Environment for Frontend4:28

    Prepare the frontend code to connect to relay compliant backend using Relay client. This involves ejecting the create-react-app to add babel-plugin-relay and creating basic components to list and display posts.

    • Use yarn eject so that we can alter the create-react-app build process and add babel-plugin-relay

    • Create ListPage component to list multiple posts with mock data that has same structure as the data that would later come from Relay compliant GraphQL backend backend

    • Create Post component that displays title of one post and on click opens title and content in a react modal

  • Getting Started with React Router3:30

    With React and Relay frontend we still need some help in solving the routing mechanism and another component to create posts to live on a separate create-post route.

    • Install react-router-dom package and import it in the project

    • Create a component to create a post that has title and content fields along with a post button

    • Use the react router and define the routing to load CreatePost component when the browser hits create-post route

  • Connecting Relay to GraphQL Backend12:01

    Connect the frontend components using mock data for now and relay compliant backend with each other. The process involves writing co-locating fragments with data and running relay compiler to render queries and mutations.

    • Define data requirements of Post component, ListPage component via fragments and removing mock data dependencies

    • Run the get-graphql-schama helper to get schema.graphql file to pass to relay-compiler and get listing from actual backend

    • Add CreatePostMutation mutation and use it in CreatePost component to create new posts from frontend

  • Authentication Strategies with GraphQL1:47

    Discuss ways in which Authentication/Authorization can be handled in GraphQL which are implementations in full GraphQL, full outside GraphQL in the wrapper framework and hybrid of the two.

    • Discuss that how the spec is not rigid about the authentication strategies yet

    • Take a look at that strategies including full GraphQL, full framework and hybrid implementations

    • Talk about our implementation which is full GraphQL in nature

  • Preparing the GraphQL Backend for Authentication7:32

    Prepare the GraphQL backend for authentication and add author to Post type. Also, create the mutations necessary for the authentication workflow.

    • Create a User type and extend node interface to support it

    • Add author field to Post type using the User model

    • Create CreateUserMutation and LoginUserMutation to complete the mutation workflow

  • Connecting the Frontend to GraphQL Authentication API6:57

    Connect the frontend to newly created Authentication API. Limiting create post function only to logged in uses and implement login/logout workflow.

    • Add a Login+Signup component and connect it to CreateUserMutation and LoginUserMutation

    • Add route in ListPage component to access Login component. Also, implement logout

    • Add author id submission while post is being created

  • Relay Connection Specification2:20

    Discuss the pagination workflow with relay client and relay compliant backend by taking a look at the connect objects.

    • Take a look at edge type that has fields node and cursor

    • Take a look at PostInfo that has directional workflow for pagination

    • Take a look at the connection argument to control the pagination

  • Implementing Cursor in GraphQL Backend3:28

    Extend the base connection provided by the graphql-relay package and add an argument to implement post ordering.

    • Revisit the existing connection code including connectionDefinitions and connectionArgs

    • Extend the connectionArgs with spread operator to have an order field

    • Use the new order field in resolver and through it the post model and implement post ordering

  • Adding Pagination to Frontend by Using PaginationContainer4:14

    Connect the frontend to use the pagination features provided by relay compliant backend by using createPaginationContainer in place of createFragment container.

    • Wrap the ListPage component in createPaginationContainer

    • Setup the createPaginationContainer with required pagination arguments

    • Create Load More button and use relay prop to control pagination

  • Why Do We Need Query Batching?2:00

    Explore what query batching is and why do we need it. Discuss one use case in our blog application where we can use query batching.

    • Update the backend code to a more production like code but it will break the frontend

    • Discuss query batching and how it can help us build auto login in GraphiQL

    • See a demo of mutation batching for create and login user in GraphiQL

  • Execution Order of Batched Queries and Mutations2:11

    Explore query batching in detail discussing the execution order of batched queries and mutations. Discuss how we can solve field conflicts in batched queries and mutations using GraphQL aliases.

    • Take a look at an example of query batching but with field conflict

    • Discuss how we can use aliases to resolve the field conflict

    • Update the batched queries and use aliases to resolve the field conflict

  • Implementing Batching of Create and Login User Mutation2:17

    Explore how we can fix the frontend auto login workflow using query batching.

    • Update the frontend code to combing create user and login user mutation

    • Run relay-complier to regenerate the frontend queries

    • Demo the auto login workflow in the fixed frontend

  • Setting Up the Environment for Testing4:13

    Set up the environment for testing and explore react storybooks which are a tool to do visual testing and iterative component development.

    • Install and setup storybooks

    • Expose the post component without relay container for easier integration with storybooks

    • Write storybook stories for the post component

  • Writing Test Cases for GraphQL Backend2:48

    Writing test cases for a complex workflow in the GraphQL backend. We will setup automated test cases for authentication workflow.

    • Set up Jest as a dev dependency for the backend

    • Discuss briefly about Jest

    • Write test cases for creating user mutation and login user mutation covering authentication workflow

  • Writing Test Cases for React Frontend3:53

    Writing automated test cases for react component including test cases for interactions like click.

    • Set up enzyme and related react testing dependencies

    • Discuss briefly about Enzyme and its features

    • Write test cases for post component title placement and click to open modal

  • Test your knowledge

Requirements

  • Some familiarity with React or Node .js is expected.
  • Some previous knowledge of writing RESTful services with JavaScript, Node .js and React is required.
  • You should already have some basic knowledge of creating a web application with React.

Description

GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API.

One of the most common problems with REST is over and under fetching of data. GraphQL gives you the flexibility to think of the APIs as a graph and not as endpoints. Hence the execution becomes easier and quicker. GraphQL is a data-fetching API developed by Facebook, which has been using it for five years; it powers millions of devices and most components of the Facebook and Instagram website.

This comprehensive 3-in-1 course is packed with step-by-step instructions, working examples, and helpful advice about GraphQL. You will learn to build your Blog with GraphQL. This friendly course takes you through the use of GraphQL to develop better RESTful Web Services. In this course, you will get an introduction into GraphQL as a bridge for React client application to communicate with servers as the missing data-fetching or query language.

Contents and Overview

This training program includes 3 complete courses, carefully chosen to give you the most comprehensive training possible.

The first course, Learning GraphQL with React and Relay, covers mastering GraphQL by building a blog with React and Relay. In this course, we will learn about GraphQL and how we can use it to create truly decoupled client and server. Writing backend with GraphQL makes our code more declarative wherein the client demands certain data in a particular format and the server responds in a predictable manner. This enables us to evolve our API without versions and iterate on features faster. For front-end and networking, we will use Facebook’s React and Relay respectively. We will learn GraphQL by creating a backend for a blog platform. You will learn about GraphQL schema design, authentication, pagination, testing, query batching and more and how to connect a GraphQL backend to React and Relay client. The course will teach everything to get up and running with GraphQL and React.

The second course, Hands-on GraphQL for Better RESTful Web Services, covers use of GraphQL the new API standard to provide an alternative to REST. In this course, you will start with getting ready to install and explore GraphQL for a better RESTful experience. Explore the architecture and use cases to better understand the package setup and architecture involved. Learn more about the GraphQL server by coding its routes and constructing its schema. All the demonstrations in this video course will be shown through the development of a typical real-world restaurant rating application to better understand of users. Learn how to deal with validation, error handling, and security. Finally, you will learn and know more about caching & batching requests, pagination in GraphQL and so on.

The third course, Hands-on Application Building with GraphQL, covers rapidly building web applications using GraphQL. In this course, you will learn how to build your own Trello-like web application using GraphQL. Build a Graphql server and a client UI and connect this Apollo-based client to the server. You will then learn to add features to your board such as adding or editing a task. You will then see how to implement the shared whiteboard functionality by populating the changes into others sessions and how to solve the conflicts in this real-world scenario with concurrent changes from different users. . The course then shows you how to add authentication to your application to prevent unwanted access to it and user centric web service

Finally, you will learn troubleshooting typical problems that may occur while running your app, and how to fine-tune the schema and communication of client-server. By the end of the course, you will be able to build your own applications using GraphQL.

By the end of the course, you’ll rapidly build web applications, better RESTful Web Services, as well as create a blog using GraphQL, React, and Relay!

About the Authors

  • Divyendu is from the top part of India, a beautiful place called Jammu and Kashmir. He loves to write code both as a hobby and production level. He has been writing hobby code for over a decade and professionally for 4 years. When not coding he engages in football, reading, travels, food (not in order).

  • Ashwin Hegde is a Software Engineer and Full Stack JavaScript Engineer with around 7 years' experience in web, mobile and API development for both service and product software development companies. He has experience in Product development from scratch with end-2-end process. Maintenance projects, re-engineering, code review, uniting and Functional testing, enterprise application development, packaging, deployment, and troubleshooting issues related to projects. He learns from other experts across the community and loves open source development and contributions.

  • Robert Hostlowsky (@rhosts) has been gaining experience in various roles in software development. He currently works at codecentric AG as a senior consultant and as a developer and technical coach, following the goals of high quality and efficiency. Since 2012 He has been an enthusiastic supporter of the software crafts movement. For more than 2 years he has been working with GraphQL. As a speaker at various conferences and meetups, he has presented this topic to more than 500 people.

Who this course is for:

  • Developers interested in learning GraphQL.
  • Programmers/developers who want to solve their specific REST API problems such as over and under fetching, multiple endpoints, and more.