graphql-server-express -> apollo-server-express; remove Optics integration

This commit is contained in:
SachaG 2017-11-21 18:33:52 +09:00
parent 319fbb914b
commit 4b862db660
3 changed files with 72 additions and 18 deletions

67
package-lock.json generated
View file

@ -24,6 +24,14 @@
"json-schema-traverse": "0.3.1"
}
},
"apollo-cache-control": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/apollo-cache-control/-/apollo-cache-control-0.0.7.tgz",
"integrity": "sha512-DoMTr3uTC5Cx9ukSO63wlzHD15C37FwZuoOZEu+m/UTzVFKQ4PnlBKzwZ0H2+iIwcdSulV0xte6Z3wBe9lHAOA==",
"requires": {
"graphql-extensions": "0.0.5"
}
},
"apollo-engine": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/apollo-engine/-/apollo-engine-0.5.4.tgz",
@ -54,6 +62,38 @@
"integrity": "sha512-ecpP1HrlP+eb5mNQuz7ObzMWtGJA78UrPlzGRes1KiKJ/c8e1UrrAWI/wuI0Ry7fIKYA6dUzxJ4fHR5TEnMAVA==",
"optional": true
},
"apollo-server-core": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/apollo-server-core/-/apollo-server-core-1.2.0.tgz",
"integrity": "sha1-6FHEdESZG2+J+IUpI3B2uD4B6O4=",
"requires": {
"apollo-cache-control": "0.0.7",
"apollo-tracing": "0.1.1",
"graphql-extensions": "0.0.5"
}
},
"apollo-server-express": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/apollo-server-express/-/apollo-server-express-1.2.0.tgz",
"integrity": "sha1-AmsStFO47KxgRLIFtqhf5Zb7X54=",
"requires": {
"apollo-server-core": "1.2.0",
"apollo-server-module-graphiql": "1.2.0"
}
},
"apollo-server-module-graphiql": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/apollo-server-module-graphiql/-/apollo-server-module-graphiql-1.2.0.tgz",
"integrity": "sha1-iZ2E87dHeV27/INUqlFiLvA4FRw="
},
"apollo-tracing": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/apollo-tracing/-/apollo-tracing-0.1.1.tgz",
"integrity": "sha512-OrL0SYpmwNs6R339y7Is6PppOkyooMB1iLSN+HAp1FdBycQ88SqVV5Dqjxb4Du+TrMyyJLHfR5BAENZSFQyWGQ==",
"requires": {
"graphql-extensions": "0.0.5"
}
},
"asn1": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz",
@ -146,6 +186,11 @@
"vary": "1.1.2"
}
},
"core-js": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz",
"integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs="
},
"core-util-is": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -250,6 +295,15 @@
"assert-plus": "1.0.0"
}
},
"graphql-extensions": {
"version": "0.0.5",
"resolved": "https://registry.npmjs.org/graphql-extensions/-/graphql-extensions-0.0.5.tgz",
"integrity": "sha512-IbgYhKIyI60Nio/uJjkkiXaOZ2fI8ynAyzcA/okD0iuKzBdWX4Tn6tidMLgd16Bf2v3TtNnyXnN0F2BJDs6e4A==",
"requires": {
"core-js": "2.5.1",
"source-map-support": "0.5.0"
}
},
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@ -427,6 +481,19 @@
"hoek": "4.2.0"
}
},
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
},
"source-map-support": {
"version": "0.5.0",
"resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.0.tgz",
"integrity": "sha512-vUoN3I7fHQe0R/SJLKRdKYuEdRGogsviXFkHHo17AWaTGv17VLnxw+CFXvqy+y4ORZ3doWLQcxRYfwKrsd/H7Q==",
"requires": {
"source-map": "0.6.1"
}
},
"sshpk": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.1.tgz",

View file

@ -14,6 +14,7 @@
"apollo-client": "^1.2.2",
"apollo-engine": "^0.5.4",
"apollo-errors": "^1.4.0",
"apollo-server-express": "^1.2.0",
"babel-runtime": "^6.18.0",
"bcrypt": "^0.8.7",
"body-parser": "^1.18.2",
@ -33,7 +34,6 @@
"graphql": "^0.9.6",
"graphql-anywhere": "^3.0.1",
"graphql-date": "^1.0.2",
"graphql-server-express": "^0.6.0",
"graphql-tag": "^2.0.0",
"graphql-tools": "^0.10.1",
"graphql-type-json": "^0.1.4",

View file

@ -1,9 +1,8 @@
import { graphqlExpress, graphiqlExpress } from 'graphql-server-express';
import { graphqlExpress, graphiqlExpress } from 'apollo-server-express';
import bodyParser from 'body-parser';
import express from 'express';
import { makeExecutableSchema } from 'graphql-tools';
import deepmerge from 'deepmerge';
import OpticsAgent from 'optics-agent'
import DataLoader from 'dataloader';
import { formatError } from 'apollo-errors';
import compression from 'compression';
@ -64,11 +63,6 @@ const createApolloServer = (givenOptions = {}, givenConfig = {}) => {
config.configServer(graphQLServer);
// Use Optics middleware
if (process.env.OPTICS_API_KEY) {
graphQLServer.use(OpticsAgent.middleware());
}
// Use Engine middleware
if (engineApiKey) {
graphQLServer.use(engine.expressMiddleware());
@ -97,12 +91,9 @@ const createApolloServer = (givenOptions = {}, givenConfig = {}) => {
options.context = {};
}
// Add Optics to GraphQL context object
if (process.env.OPTICS_API_KEY) {
options.context.opticsContext = OpticsAgent.context(req);
options.tracing = true;
options.cacheControl = true;
}
// enable tracing and caching
options.tracing = true;
options.cacheControl = true;
// Get the token from the header
if (req.headers.authorization) {
@ -186,10 +177,6 @@ Meteor.startup(() => {
resolvers: GraphQLSchema.resolvers,
});
if (process.env.OPTICS_API_KEY) {
OpticsAgent.instrumentSchema(executableSchema)
}
createApolloServer({
schema: executableSchema,
});