How to use the dynamoose.local function in dynamoose

To help you get started, we’ve selected a few dynamoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zhenyulin / serverless-hot-boilerplate / src / libs / dynamoose.js View on Github external
import dynamoose from 'dynamoose';

/* istanbul ignore next */
if (process.env.IS_OFFLINE) {
	process.env.AWS_REGION = 'localhost';
	dynamoose.local();
}

/* istanbul ignore next */
if (process.env.NODE_ENV === 'test') {
	process.env.AWS_REGION = 'localhost';
	process.env.DYNAMODB_TABLE = `test-table-${process.env.JEST_WORKER_ID}`;
	dynamoose.local();
}

export default dynamoose;
github lucianopf / bitwages / lib / db.js View on Github external
const dynamoose = require('dynamoose')
const dynamoURL = process.env.dynamoURL || 'defaultDynamoDbUrl'

dynamoose.AWS.config.update({
  accessKeyId: process.env.accessKeyId || 'defaultKey',
  secretAccessKey: process.env.secretAccessKey || 'defaultKey',
  region: process.env.region || 'defaultKey'
})
dynamoose.local(dynamoURL)

const Api = dynamoose.model('api', {
  id: {
    type: Number,
    hashKey: true,
    index: true
  },
  timestamp: {
    type: Date,
    index: true
  },
  PricesSummary: Array,
  percentageOverBitwage: Array,
  USDBRL: Array,
  USDBRLACTIVEACTION: Array,
  USDBRLPASSIVEACTION: Array,
github belongco / nextjs-serverless-setup / server.js View on Github external
dynamoose.AWS.config.update({
  region: process.env.SERVICE_AWS_REGION,
});


if (process.env.NODE_ENV === 'development') {
  /*
    For development environment, atleast with dynamoose library,
    you need to pass mock access key & secret.
  */
  dynamoose.AWS.config.update({
    accessKeyId: process.env.AWS_ACCESS_KEY,
    secretAccessKey: process.env.AWS_ACCESS_SECRET,
    region: process.env.SERVICE_AWS_REGION,
  });
  dynamoose.local('http://localhost:8000');
}

const port = parseInt(process.env.PORT, 10) || 3000;
const dev = process.env.NODE_ENV !== 'production';
const app = next({ dev });
const handle = app.getRequestHandler();

const Dog = require('./models/Dog');

function createServer() {
  const server = express();

  server.get('/api/dog/:breed', async (req, res) => {
    const { breed } = req.params;
    try {
      const dogData = await Dog.query('breed').eq(breed).exec();

dynamoose

Dynamoose is a modeling tool for Amazon's DynamoDB (inspired by Mongoose)

Unlicense
Latest version published 2 months ago

Package Health Score

95 / 100
Full package analysis