是否存在在本地运行AWS Lambdas的开发服务器?我的要求是
nodejs
服务器,没有ruby
或go
或除node
和npm
个软件包之外需要安装的任何内容wget
/ curl
或API测试工具查询以发送各种活动js
文件,并且当我更改该文件时服务器应该重新启动/更新答案 0 :(得分:3)
这是一个不需要for comb in itertools.combinations(my_list,3):
combi_list.append(comb)
combi_list_new = list(set(combi_list))
print len(combi_list_new)
mainlist_chunk = []
list_coupled_count_chunk = []
for comb in combi_list_new:
if comb not in mainlist_chunk:
mainlist_chunk.append(comb)
temp_coupled = []
temp_coupled.append(comb)
temp_coupled.append(int(1))
list_coupled_count_chunk.append(temp_coupled)
else:
for ind in range(len(mainlist_chunk)):
if mainlist_chunk[ind] == comb:
list_coupled_count_chunk[ind][1] = list_coupled_count_chunk[ind][1] + 1
with open("C:\\chunk_count.txt","ab") as bb:
wd = csv.writer(bb,delimiter = "\t")
wd.writerows(list_coupled_count_chunk)
bb.close()
或serverless
的解决方案。
为此,我通常只编写自己的小claudiajs
脚本。我总是只使用Lambda Proxy集成,因此它更简单。
像这样......
express
然后,使用const bodyParser = require('body-parser')
const express = require('express')
// Two different Lambda handlers
const { api } = require('../src/api')
const { login } = ('../src/login')
const app = express()
app.use(bodyParser.json())
// route and their handlers
app.post('/login', lambdaProxyWrapper(login))
app.all('/*', lambdaProxyWrapper(api))
app.listen(8200, () => console.info('Server running on port 8200...'))
function lambdaProxyWrapper(handler) {
return (req, res) => {
// Here we convert the request into a Lambda event
const event = {
httpMethod: req.method,
queryStringParameters: req.query,
pathParameters: {
proxy: req.params[0],
},
body: JSON.stringify(req.body),
}
return handler(event, null, (err, response) => {
res.status(response.statusCode)
res.set(response.headers)
return res.json(JSON.parse(response.body))
})
}
}
运行它,以便它监视文件并根据需要重新加载。
nodemon
答案 1 :(得分:0)
你检查过SAM Local吗? https://github.com/awslabs/aws-sam-local