fastapi-master/docs_src/custom_response/tutorial009b.py

11 lines
217 B
Python
Raw Permalink Normal View History

2024-08-24 12:41:47 +08:00
from fastapi import FastAPI
from fastapi.responses import FileResponse
some_file_path = "large-video-file.mp4"
app = FastAPI()
@app.get("/", response_class=FileResponse)
async def main():
return some_file_path