0.3.0 • Published 6 years ago

@kartikrao/sls-dynamodb-client v0.3.0

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

sls-dynamodb-client

serverless

A module to make dynamodb client creation environment agnostic.

  • Use the same DynamoDB client code for local development and on AWS Lambda.
  • Pass options to DynamoDB or DocumentClient
  • Use a custom endpoint for dynamodb-local

Dependencies

Installation

npm install --save sls-dynamodb-client

Usage

const ddb = require('sls-dynamodb-client')();

// Get a DocumentClient - AWS.DynamoDB.DocumentClient()
let docClient = ddb.getDocumentClient();

// Get the low level client - AWS.DynamoDB()
let dynamodb = ddb.getClient();

Custom local endpoint

const ddb = require('sls-dynamodb-client')("customregion", "http://customhost:customport/");

// DocumentClient requests will go to "customhost:customport"
let docClient = ddb.getDocumentClient();

// DynamoDB client requests will go to "customhost:customport"
let dynamodb = ddb.getClient();

Passing Options

const ddb = require('sls-dynamodb-client')("customregion", "http://customhost:customport/");
let options = {"convertEmptyValues": true};
let docClient = ddb.getDocumentClient(options);

References

0.3.0

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago