diff --git a/index.js b/index.js index 11e62cde5d..6ab02e57e4 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ const express = require('express') const http = require('http') -const corsRules = require('./cors-rules') +const cors = require('cors') const { createApolloServer } = require('./lib/apollo') const transaction = require('./lib/routes/transaction') @@ -15,10 +15,10 @@ const app = express() const httpServer = http.createServer(app) app.use(express.json()) -app.use(config.transactionPath, corsRules(), transaction) +app.use(config.transactionPath, cors(), transaction) const apolloServer = new createApolloServer(httpServer) -app.use(apolloServer.getMiddleware({ app, path: config.queryPath })) +app.use(apolloServer.getMiddleware({ app, path: config.queryPath, cors: true })) httpServer.listen({ port: config.port }, () => { console.log(`GraphQL Queries ready at ${apolloServer.graphqlPath}`)