return FALSE; $r = well_tag_thread__update(array('id' => $id), $update); return $r; } function well_tag_thread_find($tagid, $page, $pagesize) { $arr = well_tag_thread__find(array('tagid' => $tagid), array('id' => -1), $page, $pagesize); return $arr; } function well_tag_thread_find_by_tid($tid, $page, $pagesize) { $arr = well_tag_thread__find(array('tid' => $tid), array(), $page, $pagesize); return $arr; } ?>javascript - How to query local dynamoDB using dynamoose? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to query local dynamoDB using dynamoose? - Stack Overflow

programmeradmin1浏览0评论

As a developer, i don't want to connect all the time to Amazon web services, and I installed DynamoDB in my local puter referring the AWS Docs. I am using node.js in the backend.

I am using dynamoose as the modeling tool for Amazon's DynamoDB in my production, How can I use the same dynamoose for querying my local DynamoDB tables for development?

As a developer, i don't want to connect all the time to Amazon web services, and I installed DynamoDB in my local puter referring the AWS Docs. I am using node.js in the backend.

I am using dynamoose as the modeling tool for Amazon's DynamoDB in my production, How can I use the same dynamoose for querying my local DynamoDB tables for development?

Share Improve this question edited Jan 12, 2018 at 17:13 Charlie Fish 20.6k23 gold badges106 silver badges198 bronze badges asked Jan 12, 2018 at 10:17 SabreenaSabreena 6492 gold badges13 silver badges25 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 2

You just use this in your code:

dynamoose.local();

Assuming you have a properties file in your application, you probably want a property flag to indicate whether you are in Development or Production. Then in your code, get the property, if you are in Development, run the dynamoose.local() line.

EDIT: I don't code in javascript but it will be something like:

const { NODE_ENV } = process.env
if (NODE_ENV == "DEV") {
    dynamoose.local();
}

This assume you have a properties file in your application where you set a system property called "environment" to have a value of say "DEV" or "PROD".

There may be a version thing, but I had to do

var dynamoose = require('dynamoose');
dynamoose.aws.ddb.local();

If you are looking for newer versions of dynamoose the correct syntax is.

dynamoose.aws.ddb.local(http://localhost:8000)

https://dynamoosejs./guide/Dynamoose/#dynamooseawsddblocalendpoint

The code below should allow you to setup Dynamoose for use locally.

var dynamoose = require('dynamoose');
dynamoose.local('http://localhost:8000');

This assumes DynamoDB is running locally on port 8000. If you are not running DynamoDB Local on port 8000 you will have to update the second line above to reflect the correct port.

Edit

As mentioned in the ments you don't need to specify 'http://localhost:8000' as those are the defaults. You can of course change the port or host to be what you want if you are not using the default options of port being 8000 and host being localhost.

发布评论

评论列表(0)

  1. 暂无评论