title: DynamoDB API in Serverless
body: <p>I'm using serverless framework to create an application that writes and reads data from DynamoDB. I follow their <a href="https://serverless.com/blog/serverless-express-rest-api/" rel="nofollow noreferrer">official docs</a> and look into other examples on <a href="https://github.com/serverless/examples/tree/master/aws-node-rest-api-with-dynamodb" rel="nofollow noreferrer">github</a>.</p>
  
  <p>As far as I understand Serverless uses AWS SDK for NodeJS under the hood.</p>
  
  <p>I noticed the DynamoDB API Difference in Serverless and official AWS SDK.</p>
  
  <ol>
  <li><p>Method names. They are different: in the official AWS SDK docs for reading there's a <code>getItem</code> method (<a href="https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/DynamoDB.html#getItem-property" rel="nofollow noreferrer">link for the docs</a>), whereas in the Serveless <code>get</code> method is being used (<a href="https://github.com/serverless/examples/blob/master/aws-node-rest-api-with-dynamodb/todos/get.js#L16" rel="nofollow noreferrer">link</a>) everywhere.</p></li>
  <li><p>Params definition:</p></li>
  </ol>
  
  <p>In accordance to the official documentation I need to use the following convention to create params:</p>
  
  <pre><code>var params = {
    Key: {
      UserId: {
        S: '123456'
      }
    },
    TableName: 'Users'
  };
  
  dynamodb.getItem(params, function(err, data) {
     ...
  })
  </code></pre>
  
  <p>However, Serverless shows a different approach:</p>
  
  <pre><code>const params = {
    Key: {
      UserId: '123456'
    },
    TableName: 'Users'
  }
  
  dynamoDb.get(params, (error, result) =&gt; {}
  </code></pre>
  
  <p><strong>Question:</strong> 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!</p>