Skip to content

Instantly share code, notes, and snippets.

@doomhz
Created January 12, 2017 23:28
Show Gist options
  • Save doomhz/ad025d9a53509c531be279c282814ccf to your computer and use it in GitHub Desktop.
Save doomhz/ad025d9a53509c531be279c282814ccf to your computer and use it in GitHub Desktop.
Lambda+API Gateway basic request
exports.handler = (event, context, callback) => {
var data = {
headers: event.headers,
path: event.resourcePath,
queryParams: event.queryStringParameters,
pathParams: event.pathParameters,
bodyParams: event.body,
method: event.httpMethod
}
var response = {
statusCode: 200,
headers: {
"Access-Control-Allow-Origin": "*",
"Content-Type": "application/json"
},
body: JSON.stringify(data)
}
callback(null, response);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment