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 { | |
pathParameters: { id } | |
} = event; | |
const { title } = JSON.parse(event.body); | |
const params = { | |
TableName: "books", |
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 { | |
pathParameters: { id } | |
} = event; | |
const params = { | |
TableName: "books", | |
Key: { id } |
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 { | |
pathParameters: { id } | |
} = event; // Extracting an id from the request path | |
const params = { | |
TableName: "books", // The name of your DynamoDB table | |
Key: { id } // They key of the item you wish to find. |
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: "books" // The name of your DynamoDB table | |
}; | |
try { | |
// Utilising the scan method to get all items in the table | |
const data = await documentClient.scan(params).promise(); |
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 crypto = require("crypto"); | |
// Generate unique id with no external dependencies | |
const generateUUID = () => crypto.randomBytes(16).toString("hex"); | |
// Initialising the DynamoDB SDK | |
const documentClient = new AWS.DynamoDB.DocumentClient(); | |
exports.handler = async event => { |
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 { | |
pathParameters: { id } | |
} = event; | |
const { title } = JSON.parse(event.body); | |
const params = { | |
TableName: "events", |
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 { | |
pathParameters: { id } | |
} = event; | |
const params = { | |
TableName: "events", | |
Key: { id } |
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 { | |
pathParameters: { id } | |
} = event; | |
const params = { | |
TableName: "events", | |
Key: { id } |
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 = { |
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 = { |