Skip to content

Commit

Permalink
rename Hapi plugins for more consistence with other integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
nnance committed Sep 14, 2016
1 parent f018f31 commit a8a168c
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions README.md
Expand Up @@ -66,11 +66,11 @@ app.listen(PORT);

### Hapi

Now with the Hapi plugins `ApolloHapi` and `GraphiQLHapi` you can pass a route object that includes options to be applied to the route. The example below enables CORS on the `/graphql` route.
Now with the Hapi plugins `apolloHapi` and `graphiqlHapi` you can pass a route object that includes options to be applied to the route. The example below enables CORS on the `/graphql` route.

```js
import hapi from 'hapi';
import { ApolloHapi } from 'apollo-server';
import { apolloHapi } from 'apollo-server';

const server = new hapi.Server();

Expand All @@ -83,7 +83,7 @@ server.connection({
});

server.register({
register: ApolloHapi,
register: apolloHapi,
options: {
path: '/graphql',
apolloOptions: {
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -2,7 +2,7 @@ export { runQuery } from './core/runQuery'
export { renderGraphiQL} from './modules/renderGraphiQL'
export { OperationStore } from './modules/operationStore'
export { apolloExpress, graphiqlExpress } from './integrations/expressApollo'
export { ApolloHapi, GraphiQLHapi } from './integrations/hapiApollo'
export { apolloHapi, graphiqlHapi } from './integrations/hapiApollo'
export { apolloKoa, graphiqlKoa } from './integrations/koaApollo'
export { apolloConnect, graphiqlConnect } from './integrations/connectApollo'
export { default as ApolloOptions} from './integrations/apolloOptions'
6 changes: 3 additions & 3 deletions src/integrations/hapiApollo.test.ts
@@ -1,5 +1,5 @@
import * as hapi from 'hapi';
import { ApolloHapi, GraphiQLHapi, HapiPluginOptions } from './hapiApollo';
import { apolloHapi, graphiqlHapi, HapiPluginOptions } from './hapiApollo';

import testSuite, { Schema } from './integrations.test';

Expand All @@ -12,15 +12,15 @@ function createApp(createOptions: HapiPluginOptions) {
});

server.register({
register: ApolloHapi,
register: apolloHapi,
options: {
apolloOptions: createOptions ? createOptions.apolloOptions : { schema: Schema },
path: '/graphql',
},
});

server.register({
register: GraphiQLHapi,
register: graphiqlHapi,
options: {
path: '/graphiql',
graphiqlOptions: {
Expand Down
10 changes: 5 additions & 5 deletions src/integrations/hapiApollo.ts
Expand Up @@ -21,7 +21,7 @@ export interface HapiPluginOptions {
apolloOptions: ApolloOptions | HapiOptionsFunction;
}

const ApolloHapi: IRegister = function(server: Server, options: HapiPluginOptions, next) {
const apolloHapi: IRegister = function(server: Server, options: HapiPluginOptions, next) {
server.method('verifyPayload', verifyPayload);
server.method('getGraphQLParams', getGraphQLParams);
server.method('getApolloOptions', getApolloOptions);
Expand Down Expand Up @@ -68,7 +68,7 @@ const ApolloHapi: IRegister = function(server: Server, options: HapiPluginOption
return next();
};

ApolloHapi.attributes = {
apolloHapi.attributes = {
name: 'graphql',
version: '0.0.1',
};
Expand Down Expand Up @@ -172,7 +172,7 @@ export interface GraphiQLPluginOptions {
graphiqlOptions: GraphiQL.GraphiQLData;
}

const GraphiQLHapi: IRegister = function(server: Server, options: GraphiQLPluginOptions, next) {
const graphiqlHapi: IRegister = function(server: Server, options: GraphiQLPluginOptions, next) {
server.method('getGraphiQLParams', getGraphiQLParams);
server.method('renderGraphiQL', renderGraphiQL);

Expand Down Expand Up @@ -200,7 +200,7 @@ const GraphiQLHapi: IRegister = function(server: Server, options: GraphiQLPlugi
next();
};

GraphiQLHapi.attributes = {
graphiqlHapi.attributes = {
name: 'graphiql',
version: '0.0.1',
};
Expand All @@ -224,4 +224,4 @@ function renderGraphiQL(route, graphiqlParams: any, reply) {
reply(graphiQLString);
}

export { ApolloHapi, GraphiQLHapi };
export { apolloHapi, graphiqlHapi };

0 comments on commit a8a168c

Please sign in to comment.