Created
August 23, 2018 11:28
-
-
Save khaledosman/17ebf8b67f8eca1c790eb726805b8438 to your computer and use it in GitHub Desktop.
aws lambda response w/ cors enabled for serverless
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function lambdaResponse (body: any, statusCode = 200): any { | |
return { | |
body: JSON.stringify(body), | |
headers: { | |
'Access-Control-Allow-Credentials': true, | |
'Access-Control-Allow-Headers': '*', | |
'Access-Control-Allow-Origin': '*' | |
}, | |
statusCode, | |
isBase64Encoded: false | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment