-
-
Save ddialar/fec4896c77d69660818a8d6916874899 to your computer and use it in GitHub Desktop.
import { | |
GraphQLObjectType, | |
GraphQLInputObjectType, | |
GraphQLString, | |
GraphQLNonNull | |
} from 'graphql'; | |
var ObjectType = new GraphQLObjectType({ | |
name: 'PhoneNumber', | |
fields: () => ({ | |
number: { type: new GraphQLNonNull(GraphQLString) }, | |
description: { type: GraphQLString } | |
}) | |
}); | |
var InputType = new GraphQLInputObjectType({ | |
name: 'PhoneNumberInput', | |
fields: () => ({ | |
number: { type: new GraphQLNonNull(GraphQLString) }, | |
description: { type: GraphQLString } | |
}) | |
}); | |
export { | |
ObjectType, | |
InputType | |
}; |
With Apollo we use .graphql
or .gql
schema definitions.
If you pay attention to the code, I'm using the raw graphql
library and this code is focused on being used with graphql-express
. No one has mentioned Apollo any where.
As you surely already know, depending on the tool you use in order to implement your GraphQL server, the schema definition is going to be different.
This code only shows the most basic way that it existed three years ago. Obviously, to implement a server this way has no sense nowadays.
Thanks! I'm New in graphql so Haven't much Idea about it. Found your content for the phone number so I asked.
Just a suggestion, try to look for up-to-date content. The post where I used that gist was typed long time ago and related tasks are not done this way right now.
I've been checking and Apollo Server repository was create on April 17, 2016 and this gist code was created on August 27, 2017.
In that date Apollo Server was irrelevant yet.
And where will we define it inside apollo server? I don't understand it's idea.