Created
March 1, 2019 08:17
-
-
Save martijnvdbrug/33471498c6432a73daf0051bb484d750 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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