Last active
August 3, 2016 07:37
-
-
Save sogko/02424a9d3388a47512a5 to your computer and use it in GitHub Desktop.
hello-world-graphql-part-1 - Schema definition (golang)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"github.com/graphql-go/graphql" | |
) | |
var queryType = graphql.NewObject(graphql.ObjectConfig{ | |
Name: "Query", | |
Fields: graphql.Fields{ | |
"latestPost": &graphql.Field{ | |
Type: graphql.String, | |
Resolve: func(p types.ResolveParams) interface{} { | |
return "Hello World!" | |
}, | |
}, | |
}, | |
}) | |
var Schema, _ = graphql.NewSchema(graphql.SchemaConfig{ | |
Query: queryType, | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var graphql = require('graphql'); | |
var queryType = new graphql.GraphQLObjectType({ | |
name: 'Query', | |
fields: { | |
latestPost: { | |
type: graphql.GraphQLString, | |
resolve: function () { | |
return 'Hello World!'; | |
} | |
} | |
} | |
}); | |
var schema = new graphql.GraphQLSchema({ | |
query: queryType | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment