Skip to content

Instantly share code, notes, and snippets.

import { GraphQLServer } from 'graphql-yoga';
//user array
const users = [{
id:"1234",
name:"jaydesai",
email: "jay@jay.com",
age:27
},{
id:"5678",
import { GraphQLServer } from 'graphql-yoga';
//user array
const users = [{
id:"1234",
name:"jaydesai",
email: "jay@jay.com",
age:27
},{
id:"5678",
const typeDefs = `
type User{
id: ID!
name: String!
email: String!
age: Int
}
`
import { GraphQLServer } from 'graphql-yoga';
const typeDefs = `
type Query {
id: ID!,
name: String!,
age: Int!,
employed: Boolean!,
Gpa:Float
}
{
"name": "graph_node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "nodemon src/index.js --exec babel-node",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
{
"presets": [
"env"
],
"plugins": [
"transform-object-rest-spread"
]
}
query GetFollowers($id: String) {
user(id: $id) {
fullname: name,
followers: @skip(if: $getFollowers) {
name
userHandle
tweets
}
}
}
query GetFollowers($id: String) {
user(id: $id) {
fullname: name,
followers: @include(if: $getFollowers) {
name
userHandle
tweets
}
}
}
query GetAccHolder($id: String!) {
accholder: user(id: $id) {
fullname: name
}
query GetAccHolder($id: String = "1") {
accholder: user(id: $id) {
fullname: name
}
}