From b9b7611b93a556cf788df7cab013b4b2c9ac2ad5 Mon Sep 17 00:00:00 2001 From: Mauricio Robayo <2121481+archemiro@users.noreply.github.com> Date: Mon, 17 Dec 2018 07:56:37 -0500 Subject: [PATCH] fix: enable cors fix #19 --- src/helpers.js | 4 ++++ template.yaml | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index 4de8c76..77f81eb 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -1,6 +1,10 @@ const config = require("./config"); const createResponse = (statusCode, body) => ({ + headers: { + "Content-Type": "application/json", + "Access-Control-Allow-Origin": "*" + }, statusCode, body: JSON.stringify(body) }); diff --git a/template.yaml b/template.yaml index 59b2103..e011d2e 100644 --- a/template.yaml +++ b/template.yaml @@ -4,9 +4,10 @@ Description: JSON API para consultar la Tasa Representativa del Mercado en la Su Globals: Api: Cors: - AllowMethods: "'*'" - AllowHeaders: "'*'" + AllowHeaders: "'Content-Type, Authorization, X-Amz-Date, X-Api-Key, X-Amz-Security-Token'" + AllowMethods: "'GET'" AllowOrigin: "'*'" + MaxAge: "'600'" Resources: TrmTable: Type: AWS::DynamoDB::Table