What is the best way to add cors or headers in apollo server4 with azure integration?

What is the best way to add cors or headers in apollo server4 with azure integration?


0

I am facing an issue in cors. We are not able to allow the Access-Control-Allow-Origin. Please let us know how to add the headers or how to handle the Cors issue.
Below added my code snippet.

const { ApolloServer } = require('@apollo/server');
const { startServerAndCreateHandler } = require('@as-integrations/azure-functions');
const server = new ApolloServer({
  typeDefs,
  resolvers,
  csrfPrevention: false, 
});
exports.graphqlHandler = startServerAndCreateHandler(server);

Thanks in advance 🙂

We are trying to solve the cors issue in apollo server 4 with azure integration.

New contributor

vasanthsp is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

4

  • search for CORS in the documentation for apollo/server

    – Jaromanda X

    2 hours ago

  • Check this document @vasanthsp

    – Pravallika KV

    2 hours ago

  • There is no document for Azure integration

    – vasanthsp

    2 hours ago

  • Try with the code app.use( '/graphql', cors({ origin: ['https://www.your-app.example', 'https://studio.apollographql.com'] }) as mentioned in this [document](https://www.apollographql.com/docs/apollo-server/security/cors/) );

    – Pravallika KV

    1 hour ago


Load 5 more related questions


Show fewer related questions

0



Leave a Reply

Your email address will not be published. Required fields are marked *