Reading donations

Our application works great so far when adding new donors and donation events. To make it usable for an organization, for the purposes of building a user interface, we need to display donations. Let’s build an API endpoint that will display all donations from the DynamoDB table.

Looking at it from the architecture standpoint, this is what we want to achieve:

If we transformed it into steps, they would look like so:

  1. A user sends an HTTP GET request
  2. API Gateway receives it and invokes the Lambda function
  3. Lambda function receives it and performs a query on the DynamoDB table
  4. Lambda function returns a response containing query results to the user

Your time to shine again!

Code changes you should make are very similar to the ones we made on the previous page. A bit of copy-pasting never hurt anyone, right?

End results

http -b GET $(chalice url)/donations

When you finish making code changes, and assuming you have at least one donation event created, invoking the API endpoint should return results similar to these:

Another great success!


Solution