Skip to content

Commit

Permalink
apollo-server-hapi: add cors option to registerServer (#1085)
Browse files Browse the repository at this point in the history
  • Loading branch information
evans authored May 23, 2018
1 parent 712a562 commit 69be8c8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/apollo-server-hapi/src/ApolloServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ServerRegistration {
options?: hapi.ServerOptions;
server: ApolloServerBase<hapi.Request>;
path?: string;
cors?: boolean;
}

export interface HapiListenOptions {
Expand All @@ -27,6 +28,7 @@ export const registerServer = async ({
app,
options,
server,
cors,
path,
}: ServerRegistration) => {
if (!path) path = '/graphql';
Expand Down Expand Up @@ -96,7 +98,7 @@ server.listen({ http: { port: YOUR_PORT_HERE } });
path: path,
graphqlOptions: server.request.bind(server),
route: {
cors: true,
cors: typeof cors === 'boolean' ? cors : true,
},
},
});
Expand Down

0 comments on commit 69be8c8

Please sign in to comment.