mirror of
https://github.com/fastapi/fastapi.git
synced 2026-06-20 05:19:20 -04:00
✨ Add support for app.frontend("/", directory="dist") and router.frontend("/", directory="dist") (#15800)
This commit is contained in:
committed by
GitHub
parent
f1d750fdda
commit
4d3dc78b26
0
docs_src/frontend/__init__.py
Normal file
0
docs_src/frontend/__init__.py
Normal file
5
docs_src/frontend/tutorial001_py310.py
Normal file
5
docs_src/frontend/tutorial001_py310.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.frontend("/", directory="dist")
|
||||
5
docs_src/frontend/tutorial002_py310.py
Normal file
5
docs_src/frontend/tutorial002_py310.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.frontend("/", directory="dist", fallback="index.html")
|
||||
5
docs_src/frontend/tutorial003_py310.py
Normal file
5
docs_src/frontend/tutorial003_py310.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.frontend("/", directory="dist", fallback="404.html")
|
||||
7
docs_src/frontend/tutorial004_py310.py
Normal file
7
docs_src/frontend/tutorial004_py310.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from fastapi import APIRouter, FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
router = APIRouter()
|
||||
|
||||
router.frontend("/", directory="dist", fallback="index.html")
|
||||
app.include_router(router, prefix="/app")
|
||||
5
docs_src/frontend/tutorial005_py310.py
Normal file
5
docs_src/frontend/tutorial005_py310.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.frontend("/", directory="dist", fallback=None)
|
||||
5
docs_src/frontend/tutorial006_py310.py
Normal file
5
docs_src/frontend/tutorial006_py310.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from fastapi import FastAPI
|
||||
|
||||
app = FastAPI()
|
||||
|
||||
app.frontend("/", directory="dist", check_dir=False)
|
||||
Reference in New Issue
Block a user