Skip to content

Instantly share code, notes, and snippets.

@radzionc
Last active October 7, 2020 15:38
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
require('dotenv').config()
const aws = require('aws-sdk')
const localDynamo = require('local-dynamo')
const { setupAWS } = require('../src/utils/aws')
const { TABLES_PARAMS } = require('../../constants/db')
module.exports = async () => {
setupAWS()
localDynamo.launch(null, process.env.DYNAMO_TESTING_PORT)
const dynamodb = new aws.DynamoDB()
try {
const data = await Promise.all(
TABLES_PARAMS.map(params => dynamodb.createTable(params).promise())
)
console.log('Database created: ', JSON.stringify(data, null, 2))
} catch (err) {
console.error('Unable to create table: ', JSON.stringify(err, null, 2))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment