mirror of
https://github.com/vale981/apollo-server
synced 2025-03-06 10:11:40 -05:00
apollo-server-hapi: add cors option to registerServer (#1085)
This commit is contained in:
parent
712a562858
commit
69be8c8429
1 changed files with 3 additions and 1 deletions
|
@ -12,6 +12,7 @@ export interface ServerRegistration {
|
|||
options?: hapi.ServerOptions;
|
||||
server: ApolloServerBase<hapi.Request>;
|
||||
path?: string;
|
||||
cors?: boolean;
|
||||
}
|
||||
|
||||
export interface HapiListenOptions {
|
||||
|
@ -27,6 +28,7 @@ export const registerServer = async ({
|
|||
app,
|
||||
options,
|
||||
server,
|
||||
cors,
|
||||
path,
|
||||
}: ServerRegistration) => {
|
||||
if (!path) path = '/graphql';
|
||||
|
@ -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,
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue