Created
October 19, 2019 16:39
-
-
Save AndrewBestbier/c5ab7bb46478918a4333ab392d44ffe6 to your computer and use it in GitHub Desktop.
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
| const AWS = require("aws-sdk"); | |
| const documentClient = new AWS.DynamoDB.DocumentClient(); | |
| exports.handler = async event => { | |
| const params = { | |
| TableName: "events" | |
| }; | |
| try { | |
| const data = await documentClient.scan(params).promise(); | |
| const response = { | |
| statusCode: 200, | |
| body: JSON.stringify(data.Items) | |
| }; | |
| return response; | |
| } catch (e) { | |
| return { | |
| statusCode: 500 | |
| }; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment