node-aws-utils
v2.1.0
Published
aws utils
Downloads
3
Readme
node-aws-utils
install dependencies
yarn install
# or
npm install
build
yarn run build
# or
npm run build
Dynamo
get item
import {DynamoDB} from "aws-sdk";
import {DynamoDocumentClient} from "node-aws-utils";
(async () => {
const tableName = 'store';
const where = {id: 1};
const dynamo = new DynamoDB.DocumentClient();
const storeData = (await DynamoDocumentClient.get(dynamo, tableName, where)).unwrap();
console.log(storeData);
// object or null
})();
put or update item
import {DynamoDB} from "aws-sdk";
import {DynamoDocumentClient} from "node-aws-utils";
(async () => {
const tableName = 'store';
const where = {id: 1};
const data = {email: '[email protected]'};
const dynamo = new DynamoDB.DocumentClient();
const updatedData = (await DynamoDocumentClient.update(dynamo, tableName, where, data)).unwrap();
console.log(updatedData);
// object or empty object
})();