Last active
August 23, 2018 06:02
-
-
Save wktk/2d53171aeab6956df141aaa52253c977 to your computer and use it in GitHub Desktop.
Add CORS headers to HTTP responces with AWS Lambda for API Gateway
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
const axios = require('axios'); | |
exports.handler = async (event) => { | |
const response = await axios.get(process.env.ENDPOINT_URL, { params: event.queryStringParameters }); | |
return { statusCode: 200, headers: { "access-control-allow-origin": "*" }, body: JSON.stringify(response.data) }; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment