mirror of
https://github.com/fastapi/fastapi.git
synced 2026-09-14 13:36:21 +08:00
17 lines
272 B
Python
17 lines
272 B
Python
|
|
from fastapi import FastAPI
|
||
|
|
from pydantic 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"}
|