-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor (graphql.js): Upgrade to the v2 of apollo (#18)
We used to get the 'graphqlKoa' and 'graphiqlKoa' before as the middle-wares, but now they have been either removed or hidden from the public. And since v2 of apollo we've faced with a BREAKING CHANGE (See:apollographql/apollo-server@dbaa465#diff-64af8fdf76996fa3ed4e498d44124800 ). In order to be compatible with the older codes users are referring, we have to do some tricks: 1) Directly refer 'graphqlKoa' from 'apollo-server-koa/dist/koaApollo' instead of 'apollo-server-koa', because it's NOT exposed through 'index.js'. 2) 'apollo-server-module-graphiql' is removed, so in order to compatible with what it was, we have to add this in our package and reuse that. And then we should rewrite 'graphiqlKoa' function as the middle-ware copied from: https://github.com/apollographql/apollo-server/blob/300c0cd12b56be439b206d55131e1b93a9e6dade/packages/apollo-server-koa/src/koaApollo.ts#L51 Notice: This change is also a BREAKING one, so please DO NOT apply to apollo's version that is less than 2.x. And there're many ambigious problems about this design of v2 for apollo (See: apollographql/apollo-server#1308). So according to chentsulin's ideas, maybe the middle-ware functions would be re-added in the future (See: apollographql/apollo-server#1282 (comment)).
- Loading branch information
1 parent
0248cb2
commit 461edf0
Showing
4 changed files
with
46 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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