From cd46e5a8c1932c28d449a737cc1f29d2b758d69e Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Sun, 5 Jun 2022 20:54:14 +0300 Subject: [PATCH] fix: enable cors in server --- functions/graphql/index.js | 9 +++++---- src/utils/consts/index.ts | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/functions/graphql/index.js b/functions/graphql/index.js index c31bbef..91e00a7 100644 --- a/functions/graphql/index.js +++ b/functions/graphql/index.js @@ -27,10 +27,11 @@ const server = new ApolloServer({ }); const apolloHandler = server.createHandler({ - cors: { - origin: "*", - methods: "*", - credentials: true, + expressGetMiddlewareOptions: { + cors: { + origin: true, + credentials: true, + } }, }); diff --git a/src/utils/consts/index.ts b/src/utils/consts/index.ts index 558a277..3c1358a 100644 --- a/src/utils/consts/index.ts +++ b/src/utils/consts/index.ts @@ -1,5 +1,5 @@ const CONSTS = { - apiEndpoint: process.env.REACT_APP_API_END_POINT ?? '/.netlify/functions' + apiEndpoint: 'http://localhost:8888/.netlify/functions' } export default CONSTS; \ No newline at end of file