DEV Community

Discussion on: Introduction to the fastapi python framework

Collapse
 
mazin_mv profile image
Mazin

Possible to deploy fastapi via Serverless path? Do you suggest to do so? :)

Collapse
 
errietta profile image
Erry Kostala

You can stick it in a container and ship it to the cloud for sure. Unless that's not what you mean?

Collapse
 
aniljaiswal profile image
Anil Jaiswal

Hey Mazin,

You can use mangum ASGI adapter for serverless.

In your main.py

from fastapi import FastAPI
from mangum import Mangum

app = FastAPI()

handler = Mangum(app)

Then you can use main.handler as your entry point for the function. Furthermore, if you want to handle all routing through FastAPI, then declare ANY /{proxy+} in your http event in serverless configuration and you're done.