Skip to content

Instantly share code, notes, and snippets.

@martijnvdbrug
Created March 1, 2019 08:17
Show Gist options
  • Save martijnvdbrug/33471498c6432a73daf0051bb484d750 to your computer and use it in GitHub Desktop.
Save martijnvdbrug/33471498c6432a73daf0051bb484d750 to your computer and use it in GitHub Desktop.
import {NestFactory} from '@nestjs/core';
import {INestApplicationContext} from '@nestjs/common';
import {AppModule} from './app/app.module';
import {ApolloServer} from 'apollo-server-cloud-functions';
export let context: INestApplicationContext;
export async function bootstrap(): Promise<any> {
context = await NestFactory.createApplicationContext(AppModule); // Initialize Nest without starting a server (because we're running in GCloud functions)
const app = context.get(AppModule);
const server = new ApolloServer({
typeDefs: app.typeDefs,
resolvers: app.resolvers,
playground: true,
introspection: true
});
return server.createHandler();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment