From 501ce08f05a3e45321fc9f3f17e32d26345db520 Mon Sep 17 00:00:00 2001 From: MTG2000 Date: Sat, 26 Mar 2022 22:46:11 +0300 Subject: [PATCH] fix: enable cors --- netlify.toml | 7 ++++++- serverless.yml | 24 ++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 serverless.yml diff --git a/netlify.toml b/netlify.toml index 10aed6d..c4a7c8c 100644 --- a/netlify.toml +++ b/netlify.toml @@ -1,3 +1,8 @@ [build] functions = "functions" # netlify-lambda builds to this folder AND Netlify reads functions from here - publish = "build" # create-react-app builds to this folder, Netlify should serve all these files statically \ No newline at end of file + publish = "build" # create-react-app builds to this folder, Netlify should serve all these files statically + +[dev] + framework = "#static" + functions = "functions" # netlify-lambda builds to this folder AND Netlify reads functions from here + publish = "build" # create-react-app builds to this folder, Netlify should serve all these files statically diff --git a/serverless.yml b/serverless.yml new file mode 100644 index 0000000..32db83f --- /dev/null +++ b/serverless.yml @@ -0,0 +1,24 @@ +custom: + serverless-offline: + httpPort: 8888 + corsAllowHeaders: "*" + +plugins: + - serverless-offline +service: serverless-graphql +provider: + name: aws + runtime: nodejs12.x + +functions: + graphql: + handler: functions/graphql/index.handler + events: + - http: + path: graphql + method: post + cors: true + - http: + path: graphql + method: get + cors: true