fastapi-master/docs_src/conditional_openapi/tutorial001.py

17 lines
281 B
Python
Raw Normal View History

2024-08-24 12:41:47 +08:00
from fastapi import FastAPI
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
openapi_url: str = "/openapi.json"
settings = Settings()
app = FastAPI(openapi_url=settings.openapi_url)
@app.get("/")
def root():
return {"message": "Hello World"}