(serverOptions = {}, graphQLOptions = {})
| 3002 | }; |
| 3003 | |
| 3004 | async function setupGraphQLServer(serverOptions = {}, graphQLOptions = {}) { |
| 3005 | if (httpServer) { |
| 3006 | await new Promise(resolve => httpServer.close(resolve)); |
| 3007 | } |
| 3008 | const server = await reconfigureServer(serverOptions); |
| 3009 | const expressApp = express(); |
| 3010 | httpServer = http.createServer(expressApp); |
| 3011 | expressApp.use('/parse', server.app); |
| 3012 | const parseGraphQLServer = new ParseGraphQLServer(server, { |
| 3013 | graphQLPath: '/graphql', |
| 3014 | ...graphQLOptions, |
| 3015 | }); |
| 3016 | parseGraphQLServer.applyGraphQL(expressApp); |
| 3017 | await new Promise(resolve => httpServer.listen({ port: gqlPort }, resolve)); |
| 3018 | return parseGraphQLServer; |
| 3019 | } |
| 3020 | |
| 3021 | async function gqlRequest(query, headers = gqlHeaders) { |
| 3022 | const response = await fetch(`http://localhost:${gqlPort}/graphql`, { |
no test coverage detected