| Total Complexity | 1 |
| Complexity/F | 1 |
| Lines of Code | 33 |
| Function Count | 1 |
| Duplicated Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | /* eslint-disable-next-line */ |
||
| 2 | import 'babel-polyfill'; |
||
| 3 | import express from 'express'; |
||
| 4 | import { ApolloServer } from 'apollo-server-express'; |
||
| 5 | import expressPlayground from 'graphql-playground-middleware-express'; |
||
| 6 | import bodyParser from 'body-parser'; |
||
| 7 | import typeDefs from './graphql/schema'; |
||
| 8 | import resolvers from './graphql/resolvers'; |
||
| 9 | import { GITHUB_TOKEN } from './constants'; |
||
| 10 | |||
| 11 | const graphQLServer = express(); |
||
| 12 | |||
| 13 | const apolloServer = new ApolloServer({ |
||
| 14 | typeDefs, |
||
| 15 | resolvers, |
||
| 16 | context: {}, |
||
| 17 | tracing: true, |
||
| 18 | playground: true, |
||
| 19 | introspection: true, |
||
| 20 | }); |
||
| 21 | |||
| 22 | process.env.NODE_TLS_REJECT_UNAUTHORIZED = `0`; |
||
| 23 | |||
| 24 | graphQLServer.use(bodyParser.json()); |
||
| 25 | apolloServer.applyMiddleware({ app: graphQLServer }); |
||
| 26 | |||
| 27 | graphQLServer.get(`/`, (_, res) => { |
||
| 28 | res.setHeader(`Access-Control-Allow-Origin`, `*`); |
||
| 29 | res.send({ token: GITHUB_TOKEN }); |
||
| 30 | }); |
||
| 31 | |||
| 32 | graphQLServer.get(`/playground`, expressPlayground({ endpoint: `/graphql` })); |
||
| 33 | |||
| 34 | export default graphQLServer; |
||
| 35 |