【发布时间】:2020-04-13 09:58:07
【问题描述】:
我有一个 AWS Lambda
service: serverlesslambda
provider:
name: aws
runtime: nodejs12.x
functions:
changeWeeklyStarterStatus:
handler: handler.changeWeeklyStarterStatus
schedule: cron(0 0 0 ? * SUN *)
及其处理程序:
"use strict";
module.exports.changeWeeklyStarterStatus = async event => {
// TODO : Put the logic of the handler here
return {
statusCode: 200,
body: JSON.stringify(
{
message: `TODO ...`,
input: event
},
null,
2
)
};
};
请注意以下行:
// TODO : 把handler的逻辑放在这里
我需要连接到 mongo 并运行一个查询,为此我创建了一些文件和文件夹:
config folder -db.js - mongo connection -production.json - params and connection string -default.json - localhost params modules folder -EmployeesSchema - A collection that I run the queries on utils folder DateUtil.js - dates manipulation LambdaUtils.js - the actual query that I run on `EmployeesSchema`
如何将所有内容上传到 AWS 并通过 Lambda 处理程序实际使用这些文件?
【问题讨论】:
标签: javascript node.js amazon-web-services aws-lambda cron