Github icon Twitter icon Facebook Globe

Build a GraphQL API using Django

Sunday 1:30pm, Manito
Intermediate

About This Tutorial

This tutorial will introduce GraphQL to the participants, and walk them through rebuilding the poll app as a GraphQL api.

What is GraphQL? (10 Minutes)

  • What does GraphQL stand for?
  • Where it came from?

Why would you consider using it? (5 Minutes)

  • What problems does GraqhQL solve.

GraphQL concepts (Schemas, Fields, Queries, Mutations) (10 Minutes)

  • Go over some of the theory behind the GraphQL concepts

    • Schemas
    • Fields
    • Queries
    • Mutations

Graphene (the go-to Python GraphQL framework) (5 Minutes)

  • Overview of the graphene framework

Setting up a project with django-graphene (30 Minutes)

  • Introduce the sample application (Polls) we shall be building
  • Setup a simple django project and walkthrough how to get django-graphene setup
  • Setup the models for the sample application (Polls)

Building your schema (10 Minutes)

  • Add a simple schema to the project and view it using the GraphiQL tool

Adding queries to your GraphQL api (10 Minutes)

  • Add the relevant queries to the schema for our sample application

Test your API with GraphiQL (10 Minutes)

  • Introduction to the GraphiQL tool and how to use it to view your data

Changing data through mutations (10 Minutes)

  • Add a mutation to the schema

Writing unit tests for your GraphQL api (20 Minutes)

  • Write tests for the queries in the API
  • Write test for the mutations in the API
  • Go over some patterns to make it easier to write these kinds of tests

Handling authorization in your GraphQL API (10 Minutes)

  • Securing data based on the logged in user

Questions

Photo of

Muranga James

I love python, really enjoy working in Django. I am a Senior Developer at Thoughtworks and have spent a few years helping clients build awesome web and mobile applications.