Migration from Apollo Server
GraphQL Yoga v2 documentation (superseded by v5): Migrate from Apollo Server to GraphQL Yoga. Learn how to migrate from Apollo Server to GraphQL Yoga.
Installation
You can start by installing graphql-yoga package.
Install Equivalent Envelop Plugins of the Apollo Server
Some features that are included within apollo-server by default must be installed as envelop plugins. Learn more about envelop plugins here.
- Apollo Federation
- If you are using Apollo Federation, install
@envelop/use-apollo-federation
- If you are using Apollo Federation, install
- Apollo Server Errors
- If you are using Apollo Server errors, install
@envelop/use-apollo-server-errors
- If you are using Apollo Server errors, install
- Apollo Tracing
- If you are using Apollo Tracing, install
@envelop/use-apollo-tracing
- If you are using Apollo Tracing, install
- Response Cache
- If you are using Response Cache, you should set up
@envelop/use-response-cachefor the same functionality
- If you are using Response Cache, you should set up
Example Initial Usage of GraphQL Yoga
For example, if you are using Apollo Server Errors:
Migration from Standalone apollo-server
You don’t need anything special. You can just use GraphQL Yoga as in the example above.
Migration from apollo-server-*
Check the integration section to choose the server framework you are using with Apollo Server.
For example, if you are using Express, you should remove server.start(){:ts} from the code
above and replace server.applyMiddleware({ app }){:ts} with the route as in
Express Integration section: