作为开发人员,我不想一直连接到 Amazon Web 服务,我在本地计算机上安装了 DynamoDB,参考 AWS 文档.我在后端使用 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:
const { NODE_ENV } = process.env
if (NODE_ENV == "DEV") {
dynamoose.local();
}
这假设您的应用程序中有一个属性文件,您在其中设置了一个名为环境"的系统属性.具有说DEV"的值或产品".
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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!