Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including dynamodb-local with all npm packages installed. Try it out:

var dynamodbLocal = require("dynamodb-local")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

dynamodb-local v0.0.26

A wrapper for AWS DynamoDB Local, intended for use in testcases

dynamodb-local

A wrapper for AWS DynamoDB Local, intended for use in testcases. Will automatically download the files needed to run DynamoDb Local.

You can optionally override the download URL from where it fetches the installation archive as well as the target directory to which it will install the binaries (default is your system's temp folder).

Usage

Install the module as development dependency by running

npm install dynamodb-local --save-dev

Then in node, write your test script like this:

const DynamoDbLocal = require('dynamodb-local');
const dynamoLocalPort = 8000;

DynamoDbLocal.launch(dynamoLocalPort, null, ['-sharedDb']) //if you want to share with Javascript Shell
    .then(function () {

        // do your tests

        DynamoDbLocal.stop(dynamoLocalPort);
    });

Alternatively if you wish to use this as detached server like this:


const DynamoDbLocal = require('dynamodb-local');
const dynamoLocalPort = 8000;

const child = await DynamoDbLocal.launch(dynamoLocalPort, null, [], false, true); // must be wrapped in async function

// do your tests

await DynamoDbLocal.stopChild(child); // must be wrapped in async function

Another example which also shows how to override the installer configuration can be found in examples/simple.js.

See AWS DynamoDB Docs for more info on how to interact with DynamoDB Local.

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free