问题描述
作为开发人员,我不想一直连接到Amazon Web服务,并且我在本地计算机上安装了DynamoDB,并引用了。我在后端中使用node.js。
As a developer, i don't want to connect all the time to Amazon web services, and I installed DynamoDB in my local computer referring the AWS Docs. I am using node.js in the backend.
我在生产中使用dynamoose作为Amazon DynamoDB的建模工具,如何使用相同的dynamoose来查询我的产品本地DynamoDB开发表?
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?
推荐答案
您只需在代码中使用它:
You just use this in your code:
dynamoose.local();
假设您的应用程序中有一个属性文件,则可能需要一个属性标志来表明您是否在开发或生产中。然后在您的代码中获取属性,如果您正在开发中,请运行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.
编辑:我没有用JavaScript编写代码,但它类似于:
I don't code in javascript but it will be something like:
String environment = getSystemProperty('environment');
if (environment.valueOf() == "DEV") {
dynamoose.local();
}
这假设您的应用程序中有一个属性文件,您在其中设置了系统属性称为环境,其值为 DEV或 PROD。
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".
这篇关于如何使用Dynamoose查询本地dynamoDB?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!