Skip to content

Commit

Permalink
apollo-server: remove options to configure healthcheck, cors, bodypar…
Browse files Browse the repository at this point in the history
…ser in default server (#1090)
  • Loading branch information
evans authored May 24, 2018
1 parent 45d3614 commit 5d109e9
Showing 1 changed file with 7 additions and 21 deletions.
28 changes: 7 additions & 21 deletions packages/apollo-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,38 +16,24 @@ export * from './exports';
export class ApolloServer extends ApolloServerBase<Request> {
// here we overwrite the underlying listen to configure
// the fallback / default server implementation
async listen(
opts: ListenOptions & {
onHealthCheck?: (req: Request) => Promise<any>;
disableHealthCheck?: boolean;
bodyParserConfig?: OptionsJson;
cors?: CorsOptions;
} = {},
): Promise<ServerInfo> {
const {
disableHealthCheck,
bodyParserConfig,
onHealthCheck,
cors,
...listenOpts
} = opts;

async listen(opts: ListenOptions = {}): Promise<ServerInfo> {
// we haven't configured a server yet so lets build the default one
// using express
if (!this.getHttp) {
const app = express();

//provide generous values for the getting started experience
await registerServer({
app,
path: '/',
server: this,
disableHealthCheck,
bodyParserConfig,
onHealthCheck,
cors,
bodyParserConfig: { limit: '50mb' },
cors: {
origin: '*',
},
});
}

return super.listen(listenOpts);
return super.listen(opts);
}
}

0 comments on commit 5d109e9

Please sign in to comment.