mirror of
https://code.lenaisten.de/Lenaisten/advent22.git
synced 2026-02-25 10:30:16 +00:00
- vite can proxy requests to the api in dev mode - no more CORS needed in api - static api_baseurl in axios config
34 lines
828 B
Python
34 lines
828 B
Python
from fastapi import FastAPI
|
|
from fastapi.staticfiles import StaticFiles
|
|
|
|
from .core.settings import SETTINGS
|
|
from .routers import router
|
|
|
|
app = FastAPI(
|
|
title="Advent22 API",
|
|
description="This API enables the `Advent22` service.",
|
|
contact={
|
|
"name": "Jörn-Michael Miehe",
|
|
"email": "jmm@yavook.de",
|
|
},
|
|
license_info={
|
|
"name": "MIT License",
|
|
"url": "https://opensource.org/licenses/mit-license.php",
|
|
},
|
|
openapi_url=SETTINGS.openapi_url,
|
|
docs_url=SETTINGS.docs_url,
|
|
redoc_url=SETTINGS.redoc_url,
|
|
)
|
|
|
|
app.include_router(router)
|
|
|
|
if SETTINGS.production_mode:
|
|
# Mount frontend in production mode
|
|
app.mount(
|
|
path="/",
|
|
app=StaticFiles(
|
|
directory=SETTINGS.ui_directory,
|
|
html=True,
|
|
),
|
|
name="frontend",
|
|
)
|