Skip to content

Instantly share code, notes, and snippets.

@tazarov
Created January 12, 2022 11:34
Show Gist options
  • Save tazarov/eec9fc8f2ffa8a22a1cf48d94f7b7281 to your computer and use it in GitHub Desktop.
Save tazarov/eec9fc8f2ffa8a22a1cf48d94f7b7281 to your computer and use it in GitHub Desktop.
FastAPI with React App
import logging
from fastapi import FastAPI
from starlette.responses import RedirectResponse
from starlette.staticfiles import StaticFiles
app = FastAPI()
@app.get("/")
async def index():
return RedirectResponse(url="/index.html")
app.mount("/", StaticFiles(directory="backend/ui/"), name="ui")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment