Created
September 3, 2020 22:52
-
-
Save SoftwareDevPro/61b33fbfc233eee7cd3ed50fbb52e9be to your computer and use it in GitHub Desktop.
Create an Item in a DynamoDB table
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
| async function createItem () { | |
| const createdUpdated = (new Date()).getTime(); | |
| let params = { | |
| TableName: tableName, | |
| Item: { | |
| 'userId': 'userId', | |
| 'createdAt': createdUpdated, | |
| 'updatedAt': createdUpdated | |
| } | |
| } | |
| try { | |
| await ddbObj.put(params).promise() | |
| } catch (error) { | |
| console.log(error) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment