Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

apollo-server: remove extra configuration of registerServer from listen #1090

Merged
merged 1 commit into from
May 24, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
}