Saving Documents

Now that we’ve created our table and authorized our app to connect to it, let’s save some data. When the user enters a correct answer, we’re going to save it. If they return to this problem later, we’ll show them the correct answer they entered before. To add this functionality to the app, you’ll first need to change the click handler in the problem view to capture the user input and create an object. Then we’ll see how to save that object to DynamoDB.

When writing objects to DynamoDB, we can use the DynamoDB.DocumentClient to interact with DynamoDB like a document database. The objects we store are represented as items with the object properties as attributes, and the values can be either primitive values likes Strings and ...

Get Serverless Single Page Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.