# Show GN: GCP Cloud Functions 용 ASGI application(FastAPI, Django) adapter

> Clean Markdown view of GeekNews topic #14288. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=14288](https://news.hada.io/topic?id=14288)
- GeekNews Markdown: [https://news.hada.io/topic/14288.md](https://news.hada.io/topic/14288.md)
- Type: show
- Author: [junah](https://news.hada.io/@junah)
- Published: 2024-04-12T22:35:59+09:00
- Updated: 2024-04-12T22:35:59+09:00
- Original source: [github.com/junah201](https://github.com/junah201/vellox)
- Points: 4
- Comments: 0

## Topic Body

FastAPI 혹은 Django 같은 ASGI application을 GCP Cloud Functions 위에서 작동할 수 있도록 도와주는 도구입니다.  
  
AWS Lambda는 요청이 event와 context 객체로 주어지지만, Cloud Functions은 flask Request 객체로 주어지기 때문에 이 것을 ASGI 표준에 맞춰 scope, body로 변환하여 요청을 보내고, 반환 값을 다시 flask.Response 객체로 변환하여 주는 역할을 합니다.  
  
AWS Lambda에서 동일한 기능을 하는 mangum을 참고하여 만들었습니다.  
  
이제 막 대학교에 진학한 학생이라 코드에 부족한 점이 많습니다 ㅠ  
피드백 주시면 정말 감사하겠습니다 !  
  
Github : https://github.com/junah201/vellox  
PyPi : https://pypi.org/project/vellox  
  
예시 코드 :   
```py  
from fastapi import FastAPI  
from vellox import Vellox  
  
app = FastAPI()  
  
@app.get("/")  
def read_root():  
    return {"Hello": "World"}  
  
vellox = Vellox(app=app, lifespan="off")  
  
def handler(request):  
    return vellox(request)  
```

## Comments



_No public comments on this page._
