Skip to content

Instantly share code, notes, and snippets.

@AndrewBestbier
Created October 21, 2019 16:57
Show Gist options
  • Save AndrewBestbier/2a518514504072a4602d1e97fb55d6c9 to your computer and use it in GitHub Desktop.
Save AndrewBestbier/2a518514504072a4602d1e97fb55d6c9 to your computer and use it in GitHub Desktop.
const AWS = require("aws-sdk");
const documentClient = new AWS.DynamoDB.DocumentClient();
exports.handler = async event => {
const {
pathParameters: { id }
} = event;
const params = {
TableName: "books",
Key: { id }
};
try {
const data = await documentClient.delete(params).promise();
const response = {
statusCode: 200
};
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