apollo-server#ServerInfo TypeScript Examples
The following examples show how to use
apollo-server#ServerInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: __helpers.ts From tutorial with MIT License | 6 votes |
function graphqlTestContext() {
let serverInstance: ServerInfo | null = null
return {
async before() {
const port = await getPort({ port: makeRange(4000, 6000) })
serverInstance = await server.listen({ port })
serverInstance.server.on('close', async () => {
await db.$disconnect()
})
return new GraphQLClient(`http://localhost:${port}`)
},
async after() {
serverInstance?.server.close()
},
}
}