Description
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 will you 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
Course Curriculum
Number of Lectures: 35
Total Duration: 01:26:38
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.
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.
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.
Reviews
No Review Yet