Hi all,
Has anyone here successfully updated to using Apollo 3 server within their Meteor environment?
I currently create an instance of an Apollo Server and add it to Meteor’s connect
web server using by doing this:
import {
ApolloServer,
} from "apollo-server-express";
...
const server = new ApolloServer({
...
server.applyMiddleware({
app: WebApp.connectHandlers,
path: "/graphql",
});
However, Apollo 3 has dropped official support for connect
, and now only supports express
:
In Apollo Server 3, we no longer guarantee future support for
connect. We do still run a test suite against it and we will try not to *unintentionally* break functionality under
connect, but if future changes are easier to implement in an Express-only fashion, we reserve the right to break
connect compatibility within Apollo Server 3.
(Source: Migrating to Apollo Server 3 - Apollo Server - Apollo GraphQL Docs)
While it sounds like it should work, it doesn’t since apollo-server-express
now tries to import ‘express’, and Meteor fails to launch since it can’t find this import.
Now, I realise that I could perhaps add this package, but including the whole of express when it’s not actually going to be used is really annoying.
Creating and maintaining a connect integration is even worse.
Does anyone here have any bright ideas to solve this nicely?
Note: the only reason that apollo-server-express
imports express is to get the types.