Course: Basics of GraphQL with Ruby on Rails

Basics of GraphQL with Ruby on Rails

  • Life Time Access
  • Certificate on Completion
  • Access on Android and iOS App
  • Self-Paced
About this Course

This course teaches the basics of using GraphQL in a Rails application. GraphQL is a query language invented by Facebook in 2012, and made open source in 2015. While it has certain clear advantages over REST, it also has a somewhat steeper learning curve.

Structured in a simple and accessible manner, these lectures will help you get on your way to using GraphQL to circulate data between back-end and front-end applications.

In the first section we will learn about reading data; in the second, about changing data; and the slightly more advanced third section is about protecting data.

Who is the target audience?

  • Back-end developers in Ruby on Rails who are looking for a better way to talk to front-ends
Basic knowledge
  • You should have already created at least one Ruby on Rails application
  • You should have some familiarity with what API applications are
What you will learn
  • How to add GraphQL to a Rail app so that it can talk to any Front-End
  • Enable GraphQL in a Rail app
  • Use GraphiQL, a query simulator
  • Ask for data using GraphQL Queries
  • Change data using mutations
  • Protect data using authorisation
Number of Lectures: 35
Total Duration: 01:26:38
  • Introduction  
  • What is GraphQL?  
  • GraphQL versus REST  
  • Requirements  
  • GraphiQL  
  • The default query  
Reading data
  • What we'll do  
  • JSON  
  • Introduction to queries  
  • Query arguments  
  • Query context  
  • ActiveRecord queries  
  • Scalar field types  
  • Compulsory field types  
  • User defined (ActiveRecord) types  
  • Custom field types  
  • Arrays  
  • Assignment 1  

    Start the backend of a blog app.

    • Create an app with User (first name, last name, street, number, city, postcode, country), Post (user_id, body) and Comment (user_id, body)
    • Create queries for each
    • Add fields in User to include all Posts, and in Post to include all Comments
    • User should have a custom field to return the full address and the full name.

    Solution attached.

Changing data
  • 3. What we'll do  
  • Creating records  
  • Query variables  
  • Input types  
  • Updating records  
  • Deleting records  
  • Handling validation errors  
  • Assignment 2  
    • Create CRUD operations for User, Post and Comment. Use InputTypes and vars.
    • Add at least one validation rule to the models and check for errors

    Solution attached.

Authentication, Authorisation, and Access Control
  • 4. What we'll do  
  • How authentication and authorisation work  
  • Login (authentication)  
  • Authorisation  
  • Logout  
  • Access control  
  • Visibility, Accessibility, Authorisation  
  • Assignment 3  
    • Create a migration to add hashed password and a field called "role" to User
    • Add bcrypt gem, create a user with password
    • Create a Session model (key , content )
    • Changing comments should be only accessible to users that have the role "member".

    Solution attached.

  • Conclusion  
Reviews (0)