Created
May 26, 2016 15:48
-
-
Save matrixfox/63c85331917670a82d44d3a5c7f54cff to your computer and use it in GitHub Desktop.
AWS Lambda Serverless Gateway API Function - Why is she so slow?
This file contains hidden or 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
'use strict'; | |
console.log('Loading event...'); | |
var DOC = require('dynamodb-doc'); | |
var docClient = new DOC.DynamoDB(); | |
exports.handler = function(event, context) { | |
var tableName = "databaseTableName"; | |
docClient.scan({ | |
TableName: tableName | |
}, | |
function(err, data) { | |
if (err) { | |
console.log(err, err.stack); | |
context.fail('ERROR: ' + err); | |
} else { | |
var response = {}; | |
response.records = []; | |
for (var i in data.Items) { | |
console.log(data.Items[i]); | |
response.records.push(data.Items[i]); | |
} | |
console.log(response['records']); | |
context.succeed(response['records']); | |
} | |
} | |
); | |
}; | |
console.log('Complete!'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment