Skip to content

Commit fe67089

Browse files
committed
Migrate from express-graphql to graphql-http
Same change as was just made in Mockttp. Appears to be a much smaller package with exactly the same functionality, officially supported by graphql org, and actively maintained while the old one is now deprecated. No brainer.
1 parent a7766de commit fe67089

File tree

3 files changed

+4
-87
lines changed

3 files changed

+4
-87
lines changed

package-lock.json

Lines changed: 1 addition & 81 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@
6666
"env-paths": "^1.0.0",
6767
"event-stream": "^4.0.1",
6868
"express": "^4.17.3",
69-
"express-graphql": "^0.11.0",
7069
"graphql": "^15.8.0",
70+
"graphql-http": "^1.22.0",
7171
"graphql-tag": "^2.12.6",
7272
"gunzip-maybe": "^1.4.2",
7373
"iconv-lite": "^0.4.24",

src/api/graphql-api.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import type { Application as ExpressApp } from 'express';
33

44
import { makeExecutableSchema } from '@graphql-tools/schema';
55
import { GraphQLScalarType } from 'graphql';
6-
import { graphqlHTTP } from 'express-graphql';
6+
import { createHandler as createGraphQLHandler } from 'graphql-http/lib/use/express';
77
import gql from 'graphql-tag';
88
import { ApiModel } from './api-model';
99

@@ -170,8 +170,5 @@ export function exposeGraphQLAPI(
170170
resolvers: buildResolvers(apiModel)
171171
});
172172

173-
server.post('/', graphqlHTTP({
174-
schema,
175-
graphiql: false
176-
}));
173+
server.post('/', createGraphQLHandler({ schema }));
177174
}

0 commit comments

Comments
 (0)