@Paul-Louis Pröve I believe a simple solution to the FastAPI route problem would be to mount your functions as a Sub Application at the /api
route of the main application (which won't have any endpoints). So, your code would be something like this
import azure.functions as func
from fastapi import FastAPI, Request, Response
wrapper = FastAPI()
app = FastAPI()
@app.get("/openai")
async def return_http_no_body():
# Your OpenAI Code Here
return Response(status_code=200) # Your Streaming Response Here
wrapper.mount('/api', app)
app = func.AsgiFunctionApp(app=wrapper,
http_auth_level=func.AuthLevel.ANONYMOUS)
The /api
path is required by SWA because they need a definite way to route requests to the static web app vs linked APIs, and route is not rewritten when forwarded.