Skip to content

Instantly share code, notes, and snippets.

@vincentntang vincentntang/graphql.json
Last active Sep 10, 2019

Embed
What would you like to do?
Example of a graphql setup (Resolver - handles functions, query requests data, graphql.json is the return, schema.graphql is what you can traverse
{
"data": {
"jobs": [
{
"id": "rJKAbDd_z",
"title": "Frontend Developer",
"company": {
"id": "HJRa-DOuG",
"name": "Facegle",
"description": "We are a startup on a mission to disrupt social search engines. Think Facebook meet Google."
},
"description": "We are looking for a Frontend Developer familiar with React."
},
]
}
}
{
jobs {
id
title
company {
id
name
description
}
description
}
}
const db = require('./db');
const Query = {
jobs: () => db.jobs.list()
};
const Job = {
company: (job) => db.companies.get(job.companyId)
}
module.exports = { Query, Job};
type Query {
jobs: [Job]
}
type Company {
id: ID!
name: String
description: String
}
type Job {
id: ID!
title: String
company: Company
description: String
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.