AWS Lambda API Gateway 对 Macro 和 MacroExpress (以及所有基于其构建的内容) 的支持。
它允许将任意 Macro 应用程序部署为 AWS Lambda 函数,包括 MacroApp 端点。
博客文章:在 AWS Lambda 上部署 Swift。
该模块分为 MacroLambda
模块,它提供了 Express 运行器 (Lambda.run(express-app)
) 和 MacroLambdaCore
,它仅链接到 http
并提供 lambda.createServer
(与 http.createServer
对等)。
这里有一个关于如何开始使用这些东西的教程:使用 Swift 在 AWS Lambda 上创建您的第一个 HTTP 端点。
注意:Swift Lambda Runtime 需要 Swift 5.2。
import MacroLambda
let app = Express()
app.use(bodyParser.text())
app.post("/hello") { req, res, next in
console.log("Client posted:", req.body.text ?? "-")
res.send("Client body sent: \(req.body.text ?? "~nothing~")")
}
app.get { req, res, next in
res.send("Welcome to Macro!")
}
Lambda.run(app)
使用 swift lambda
(brew install SPMDestinations/tap/swift-lambda
)
$ swift lambda deploy -d 5.2
教程可用:在 AWS Lambda 上部署 Swift。
macro.core.numthreads
macro.core.iothreads
macro.core.retain.debug
macro.concat.maxsize
macro.streams.debug.rc
Macro 由 Helge Heß / ZeeZide 呈现。我们喜欢反馈、GitHub Star、酷的合同工作,大概任何你能想到的赞扬形式。
在 Noze.io Slack 上有一个 #microexpress
频道。 欢迎加入!