-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.js
40 lines (35 loc) · 912 Bytes
/
schema.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const graphql = require('graphql')
const{
GraphQLObjectType,
GraphQLSchema,
GraphQLInt,
GraphQLString,
GraphQLList
} = graphql;
const UserType = new GraphQLObjectType({
name:'user',
fields:()=>({
id:{type:GraphQLInt},
name:{type:GraphQLString},
email:{type:GraphQLString},
phone:{type:GraphQLString}
})
})
const RootQuery = new GraphQLObjectType({
name:"xyz",
fields:{
codeimprove:{
type: new GraphQLList(UserType),
resolve(parent, args){
let data = [{
id:11, name:'aaa', email:'Kishan@gmail.com', phone:7291864691
},
{
id:12, name:'bbb', email:'Anish@gmail.com', phone:8191864691
}]
return data
}
}
}
})
module.exports = new GraphQLSchema({query: RootQuery})