Zero to GraphQL in 30 Minutes – Steven Luscher
Why Stack Overflow recommends it
Stack Overflow users link it as a practical starting point for wrapping an existing REST API or database in GraphQL and for understanding how resolvers and DataLoader batching work.
Recommended by 5 people across 4 different months, 2016 to 2019.
What it is
A 30-minute talk from a Facebook HQ tech talk series in April 2016, given by Steven Luscher of the Relay team. It shows how to put a GraphQL layer over an existing ORM, SOA, or REST API, with a live JavaScript walkthrough that also touches on DataLoader batching.
What people said
Recommends cks · 2016-05 · Stack Overflow · on “GraphQL - Get all fields from nested JSON object”
I'm putting a GraphQL wrapper over an exiting REST API as described in Zero to GraphQL in 30 minutes [this video] . I've got an API endpoint for a product with one property that points to a nested object: // API Response { entity_id: 1, nested_object: { key1: val1, key2: val2, ... } } Is it possible to define the schema so that I can get this entire nested object without explicitly defining the nested object and all of its properties? I want my query to just specify that I want the nested object, and not need to specify all the properties I want from the nested object: // What I want { product(id: "1") { entityId nestedObject } } // What I don't want { product(id: "1") { entityId nestedObject { k
Recommends HagaiCo · 2016-09 · Stack Overflow · on “Optimizing graphql database queries”
Dataloader is your answer, it has batching feature which means that it will queue all the ids. Only once its ready it will pull it as a batch. Demo can be found here [this video] (Last 5 minutes in particular) Algorithm explaination can be found here [LINK]
Recommends John William Domingo · 2016-09 · Stack Overflow · on “GraphQL + Django: resolve queries using raw PostgreSQL query”
What is the best way to use GraphQL with Django when using an external database to fetch data from multiple tables (i.e., creating a Django Model to represent the data would not correspond to a single table in my database)? My approach was to temporarily abandon using Django models since I don't think I fully understand them yet. (I'm completely new to Django as well as GraphQL.) I've set up a simple project with an app with a connected external Postgres DB. I followed all the setup from the Graphene Django tutorial [LINK] and then hit a road block when I realized the model I created was an amalgam of several tables. I have a query that sends back the proper columns mapped to the fields in m
Recommends Eran Kampf · 2017-01 · Stack Overflow · on “How to build a GraphQL API on top of a Django/Elasticsearch/MySQL backend?”
graphene is a generic GraphQL server implementation from python. Using graphene you can build a representation of your graph data and query it from anywhere (MySQL, ElasticSearch, Mongo, whatever) - each field's value is basically resolved by a resolver function which can read data from wherever needed. graphene-django is just an extension of graphene that automatically wraps django ORM and lets you easily expose django ORM objects as part of your schema without going through the hassle of defining re-defining all the objects and fields already defined in the ORM model. It does not, however, limit you to only use the django ORM. You can have many objects in relationships in your GraphQL sche
Recommends J Garcia · 2019-03 · Stack Overflow · on “Real world example of GraphQLInterfaceType and GraphQLUnionType”
@AlexanderPravdin it's not actually shown in the docs, but fields needs to be a function that returns an object, you can refer to the js portion of this very helpful video: [this video]
Cites Fluidbyte · 2017-11 · Stack Overflow · on “GraphQL Query.resolve must be an object”
I'm new to GraphQL and trying to get a basic query setup against a mock data source that just resolves a promise with a filter to pull the record by id. I have the following: const { GraphQLSchema, GraphQLObjectType, GraphQLString, GraphQLList } = require('graphql') const db = require('../db') const getUserById = (id) => db.read(id) const UserType = new GraphQLObjectType({ name: 'User', description: 'User Type', fields: () => ({ first_name: { type: GraphQLString }, last_name: { type: GraphQLString }, email: { type: GraphQLString }, friends: { type: new GraphQLList(UserType), resolve: (user) => user.friends.map(getUserById) } }) }) const QueryType = new GraphQLObjectType({ name: 'Query', desc