- 授权协议: MIT
- 开发语言: JavaScript
- 操作系统: 跨平台
- 软件首页: http://dev.apollodata.com/tools/apollo-server/index.html
- 软件文档: http://dev.apollodata.com/tools/graphql-server/index.html
软件介绍
这是一个 GraphQL 服务器,支持 Express, Connect, Hapi 和 Koa
示例代码:
Express:
import express from 'express';
import bodyParser from 'body-parser';
import { graphqlExpress } from 'graphql-server-express';
const myGraphQLSchema = // ... define or import your schema here!
const PORT = 3000;
var app = express();
// bodyParser is needed just for POST.
app.use('/graphql', bodyParser.json(), graphqlExpress({ schema: myGraphQLSchema }));
app.listen(PORT);Connect:
import connect from 'connect';
import bodyParser from 'body-parser';
import { graphqlConnect } from 'graphql-server-express';
import http from 'http';
const PORT = 3000;
var app = connect();
// bodyParser is needed just for POST.
app.use('/graphql', bodyParser.json());
app.use('/graphql', graphqlConnect({ schema: myGraphQLSchema }));
http.createServer(app).listen(PORT);Hapi:
import hapi from 'hapi';
import { graphqlHapi } from 'graphql-server-hapi';
const server = new hapi.Server();
const HOST = 'localhost';
const PORT = 3000;
server.connection({
host: HOST,
port: PORT,
});
server.register({
register: graphqlHapi,
options: {
path: '/graphql',
graphqlOptions: {
schema: myGraphQLSchema,
},
route: {
cors: true
}
},
});
server.start((err) => {
if (err) {
throw err;
}
console.log(`Server running at: ${server.info.uri}`);
});
Algorithms to Live By
Brian Christian、Tom Griffiths / Henry Holt and Co. / 2016-4-19 / USD 30.00
A fascinating exploration of how insights from computer algorithms can be applied to our everyday lives, helping to solve common decision-making problems and illuminate the workings of the human mind ......一起来看看 《Algorithms to Live By》 这本书的介绍吧!
