我正在尝试在我的 aws 项目上启用 CORS,该项目由API Gateway和Lambda功能组成。我正在使用GET和OPTIONS方法创建一个 API 网关。
OPTIONS旨在成为根据 aws文档启用 CORS 的模拟端点。有一个 lambda 函数 ( aws_lambda_function.app_lambda) 由方法调用GET,并且在响应标头中具有:
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers": "Content-Type",
"Access-Control-Allow-Methods": "OPTIONS,POST,GET"
Run Code Online (Sandbox Code Playgroud)
但我仍然无法通过 CORS。
resource "aws_api_gateway_rest_api" "rest_api" {
name = "appAPIGateway"
description = "App App App"
}
resource "aws_api_gateway_resource" "rest_api_resource" {
depends_on = ["aws_api_gateway_rest_api.rest_api"]
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
parent_id = "${aws_api_gateway_rest_api.rest_api.root_resource_id}"
path_part = "playground"
}
resource "aws_api_gateway_method" "opt" {
rest_api_id = "${aws_api_gateway_rest_api.rest_api.id}"
resource_id = "${aws_api_gateway_resource.rest_api_resource.id}"
http_method = …Run Code Online (Sandbox Code Playgroud) 使用sequelize检查db输入属性(即array)是否具有给定项。有一个包含数据Events的Postgres数据库。想要得到一个事件,将有这些的工作日。weekDays的类型为ARRAY(整数)。
Events.findOne({
where: {
weekDays: {
$contains: [2, 3],
},
},
});
Run Code Online (Sandbox Code Playgroud)
试图与$ contains,$ any或$ like $ any一起使用,但始终收到相同的错误消息。
TypeError:values.map不是函数
衷心的感谢
寻找最佳实践建议。
将函数调用for of作为可迭代对象是一个好习惯吗?
const obj = {key1:'a', key2:'b'};
for(const i of Object.keys(obj)){ ... }
Run Code Online (Sandbox Code Playgroud)
或更好地拥有
const obj = {key1:'a', key2:'b'};
const allKeys = Object.keys(obj);
for(const i of allKeys){ ... }
Run Code Online (Sandbox Code Playgroud)
不是在循环的每次迭代中都会调用 Object.keys 函数吗?
有没有办法在控制台中编辑AWS Lambda层的代码?
是否可以像lambda一样在控制台中更新图层的代码?
aws-lambda ×1
cors ×1
database ×1
ecmascript-6 ×1
javascript ×1
node.js ×1
object ×1
postgresql ×1
sequelize.js ×1
sql ×1
terraform ×1