项目
在 GitHub 查看

Kludex/mangum
关于
为 ASGI 应用提供 AWS Lambda 支持
网站与应用开发可以做什么
- Event handlers for API Gateway HTTP and REST APIs, Application Load Balancer, Function URLs, and CloudFront Lambda@Edge.
- Compatibility with ASGI application frameworks, such as Starlette, FastAPI, Quart and Django.
- Support for binary media types and payload compression in API Gateway using GZip or Brotli.
- Works with existing deployment and configuration tools, including Serverless Framework and AWS SAM.
实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- +1
- 1个月
- +1
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Mangum
Mangum is an adapter for running ASGI applications in AWS Lambda to handle Function URL, API Gateway, ALB, and Lambda@Edge events.
Documentation: https://mangum.fastapiexpert.com/
Features
Event handlers for API Gateway HTTP and REST APIs, Application Load Balancer, Function URLs, and CloudFront Lambda@Edge.
Compatibility with ASGI application frameworks, such as Starlette, FastAPI, Quart and Django.
Support for binary media types and payload compression in API Gateway using GZip or Brotli.
Works with existing deployment and configuration tools, including Serverless Framework and AWS SAM.
Startup and shutdown lifespan events.
Installation
pip install mangum
Example
from mangum import Mangum
async def app(scope, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain; charset=utf-8"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
handler = Mangum(app, lifespan="off")
Or using a framework:
from fastapi import FastAPI
from mangum import Mangum
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
handler = Mangum(app, lifespan="off")
探索相关项目
加载中…