mirror of https://github.com/tiangolo/fastapi.git
22 lines
419 B
Python
22 lines
419 B
Python
from fastapi import FastAPI
|
|
from pydantic_settings import BaseSettings
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
app_name: str = "Awesome API"
|
|
admin_email: str
|
|
items_per_user: int = 50
|
|
|
|
|
|
settings = Settings()
|
|
app = FastAPI()
|
|
|
|
|
|
@app.get("/info")
|
|
async def info():
|
|
return {
|
|
"app_name": settings.app_name,
|
|
"admin_email": settings.admin_email,
|
|
"items_per_user": settings.items_per_user,
|
|
}
|