I'm using serverless framework to create an application that writes and reads data from DynamoDB. I follow their official docs and look into other examples on github.
As far as I understand Serverless uses AWS SDK for NodeJS under the hood.
I noticed the DynamoDB API Difference in Serverless and official AWS SDK.
Method names. They are different: in the official AWS SDK docs for reading there's a
getItemmethod (link for the docs), whereas in the Servelessgetmethod is being used (link) everywhere.Params definition:
In accordance to the official documentation I need to use the following convention to create params:
var params = {
Key: {
UserId: {
S: '123456'
}
},
TableName: 'Users'
};
dynamodb.getItem(params, function(err, data) {
...
})
However, Serverless shows a different approach:
const params = {
Key: {
UserId: '123456'
},
TableName: 'Users'
}
dynamoDb.get(params, (error, result) => {}
Question: Could somebody please explain the difference and why is that? It's a little bit confusing and hard to understand which convention to follow. Thanks!