Created
June 28, 2018 03:41
-
-
Save urouro-net/2e802479a884cef5f084363874931404 to your computer and use it in GitHub Desktop.
Lambda + API Gateway Response Skelton
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
module.exports.handler = (event, context, callback) => { | |
const headers = { | |
'Access-Control-Allow-Origin': '*', | |
'Access-Control-Allow-Credentials': true | |
}; | |
const invalidResponse = { | |
statusCode: 400, | |
headers, | |
body: JSON.stringify({ error: 'Invalid.' }) | |
}; | |
if (false) { | |
callback(null, invalidResponse); | |
return; | |
} | |
callback(null, { | |
statusCode: 200, | |
headers, | |
body: JSON.stringify({ message: 'Success' }) | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment