Skip to content

Commit

Permalink
Enable default cors for all routes (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
colw authored and faboweb committed Nov 23, 2019
1 parent 45b23bf commit 287a602
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -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}`)
Expand Down

0 comments on commit 287a602

Please sign in to comment.