Unverified Commit f657e09b authored by Mahmoud Abdelwahab's avatar Mahmoud Abdelwahab Committed by GitHub

Fix CORS issue in GraphQL example that prevented Apollo Studio from working (#27486)

Update example so Apollo Studio works properly 
parent 84b71c3a
......@@ -22,15 +22,19 @@ const apolloServer = new ApolloServer({ typeDefs, resolvers })
const startServer = apolloServer.start()
export default async function handler(req, res) {
if (req.method === 'OPTIONS') {
res.end()
return false
}
res.setHeader('Access-Control-Allow-Credentials', 'true')
res.setHeader(
'Access-Control-Allow-Origin',
'https://studio.apollographql.com'
)
res.setHeader(
'Access-Control-Allow-Headers',
'Origin, X-Requested-With, Content-Type, Accept'
)
if (req.method === 'OPTIONS') {
res.end()
return false
}
await startServer
await apolloServer.createHandler({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment