You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: site/code/index.html.js
+201-7Lines changed: 201 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -29,26 +29,220 @@ Many different programming languages support GraphQL. This list contains some of
29
29
30
30
### JavaScript
31
31
32
-
- [GraphQL.js](/graphql-js/) ([github](https://github.com/graphql/graphql-js/)) ([npm](https://www.npmjs.com/package/graphql)): The reference implementation of the GraphQL specification, designed for running a GraphQL server in a Node.js environment.
33
-
- [express-graphql](/graphql-js/running-an-express-graphql-server/) ([github](https://github.com/graphql/express-graphql)) ([npm](https://www.npmjs.com/package/express-graphql)): The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server.
34
-
- [graphql-relay](https://github.com/graphql/graphql-relay-js) ([npm](https://www.npmjs.com/package/graphql-relay)): A server library to help construct a Node.js GraphQL API that supports [Relay](https://facebook.github.io/relay/).
35
-
- [Apollo Server](http://dev.apollodata.com/tools/apollo-server/index.html) ([github](https://github.com/apollostack/apollo-server)) ([npm](https://www.npmjs.com/package/apollo-server)): A GraphQL server that works with all Node.js HTTP server frameworks: Express, Connect, HAPI and Koa.
The reference implementation of a GraphQL API server over an Express webserver. You can use this to run GraphQL in conjunction with a regular Express webserver, or as a standalone GraphQL server.
63
+
64
+
To run an \`express-graphql\` hello world server:
65
+
66
+
\`\`\`bash
67
+
npm install express express-graphql graphql
68
+
\`\`\`
69
+
70
+
Then run \`node server.js\` with this code in \`server.js\`:
71
+
72
+
\`\`\`js
73
+
var express = require('express');
74
+
var graphqlHTTP = require('express-graphql');
75
+
var { buildSchema } = require('graphql');
76
+
77
+
var schema = buildSchema(\`
78
+
type Query {
79
+
hello: String
80
+
}
81
+
\`);
82
+
83
+
var root = { hello: () => 'Hello world!' };
84
+
85
+
var app = express();
86
+
app.use('/graphql', graphqlHTTP({
87
+
schema: schema,
88
+
rootValue: root,
89
+
graphiql: true,
90
+
}));
91
+
app.listen(4000, () => console.log('Now browse to localhost:4000/graphql'));
To run a hello world script with \`graphql-ruby\`:
145
+
146
+
\`\`\`bash
147
+
gem install graphql
148
+
\`\`\`
149
+
150
+
Then run \`ruby hello.rb\` with this code in \`hello.rb\`:
151
+
152
+
\`\`\`ruby
153
+
require 'graphql'
154
+
155
+
QueryType = GraphQL::ObjectType.define do
156
+
name 'Query'
157
+
field :hello do
158
+
type types.String
159
+
resolve -> (obj, args, ctx) { 'Hello world!' }
160
+
end
161
+
end
162
+
163
+
Schema = GraphQL::Schema.define do
164
+
query QueryType
165
+
end
166
+
167
+
puts Schema.execute('{ hello }')
168
+
\`\`\`
169
+
170
+
There are also nice bindings for Relay and Rails.
40
171
41
172
### Python
42
173
43
-
- [Graphene](http://graphene-python.org/) ([github](https://github.com/graphql-python/graphene)): A Python library for building GraphQL APIs. Built-in support for [Relay](https://facebook.github.io/relay/), Django, SQLAlchemy, and Google App Engine.
Then run \`python hello.py\` with this code in \`hello.py\`:
185
+
186
+
\`\`\`python
187
+
import graphene
188
+
189
+
class Query(graphene.ObjectType):
190
+
hello = graphene.String()
191
+
192
+
def resolve_hello(self, args, info):
193
+
return 'Hello world!'
194
+
195
+
schema = graphene.Schema(query=Query)
196
+
result = schema.execute('{ hello }')
197
+
print(result.data['hello'])
198
+
\`\`\`
199
+
200
+
There are also nice bindings for [Relay](https://facebook.github.io/relay/), Django, SQLAlchemy, and Google App Engine.
44
201
45
202
### Scala
46
203
47
204
- [Sangria](http://sangria-graphql.org/) ([github](https://github.com/sangria-graphql/sangria)): A Scala GraphQL library that supports [Relay](https://facebook.github.io/relay/).
48
205
49
206
### Java
50
207
51
-
- [graphql-java](https://github.com/graphql-java/graphql-java): A Java library for building GraphQL APIs.
0 commit comments