mirror of
https://github.com/vale981/apollo-server
synced 2025-03-08 19:21:40 -05:00

* Setup prettier and precommit hooks * Format code with prettier * Use husky because it works... * Move prettier config to .prettierrc file * Implement fixing markdown file formatting when running lint-fix script * Format markdown files * Add .json file formatting * Fixes json file formatting * Add pretteir linting step * Remove tslint * Use gitignore for prettier * Fix linting errors * Ignore submodule folder
46 lines
1.2 KiB
Markdown
46 lines
1.2 KiB
Markdown
---
|
|
title: Migrating to v0.3
|
|
description: How to migrate to Apollo Server 0.3 from 0.2.
|
|
---
|
|
|
|
> Note: This guide assumes you were previously up to date with `apollo-server` series `0.2.x`. If you are currently using `0.1`, consult the [previous migration guide](migration.md).
|
|
|
|
Version 0.3.0 of Apollo Server contains a couple of breaking changes in the Hapi plugin API.
|
|
The most notable changes are:
|
|
|
|
* the plugin class has been replaced as a function to be more idiomatic
|
|
* the plugin name has been renamed to use camelcase
|
|
* the options object has been extended to support additional routing options
|
|
|
|
The following code snippet for Hapi Apollo 0.2.x
|
|
|
|
```js
|
|
import { ApolloHAPI } from 'apollo-server';
|
|
...
|
|
server.register({
|
|
register: new ApolloHAPI(),
|
|
options: { schema: myGraphQLSchema },
|
|
routes: { prefix: '/graphql' },
|
|
});
|
|
```
|
|
|
|
... should be written as follows for Hapi Apollo 0.3.x
|
|
|
|
```js
|
|
import { apolloHapi } from 'apollo-server';
|
|
...
|
|
server.register({
|
|
register: apolloHapi,
|
|
options: {
|
|
path: '/graphql',
|
|
apolloOptions: {
|
|
schema: myGraphQLSchema,
|
|
},
|
|
route: {
|
|
cors: true
|
|
}
|
|
},
|
|
});
|
|
```
|
|
|
|
_NOTE:_ That you can now pass additional routing configuration via the route options
|