50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
from fastapi import FastAPI
|
|
from fastapi.middleware.cors import CORSMiddleware
|
|
|
|
from app.database import lifespan
|
|
from app.routers import ad_slots, ads, auth, deploy, feature_icons, orders, payments, products, rituals, temples, todos, uploads, users
|
|
|
|
|
|
app = FastAPI(
|
|
title="Toy User API",
|
|
description="A tiny FastAPI application with Todo and User CRUD APIs.",
|
|
version="0.2.0",
|
|
lifespan=lifespan,
|
|
)
|
|
|
|
app.add_middleware(
|
|
CORSMiddleware,
|
|
allow_origins=["http://127.0.0.1:5173", "http://localhost:5173"],
|
|
allow_credentials=True,
|
|
allow_methods=["*"],
|
|
allow_headers=["*"],
|
|
)
|
|
|
|
|
|
@app.get("/")
|
|
def read_root() -> dict[str, str]:
|
|
return {
|
|
"message": "Welcome to the Toy API.",
|
|
"docs": "/docs",
|
|
}
|
|
|
|
|
|
@app.get("/health")
|
|
def health_check() -> dict[str, str]:
|
|
return {"status": "ok"}
|
|
|
|
|
|
app.include_router(todos.router)
|
|
app.include_router(auth.router)
|
|
app.include_router(users.router)
|
|
app.include_router(temples.router)
|
|
app.include_router(products.router)
|
|
app.include_router(feature_icons.router)
|
|
app.include_router(ad_slots.router)
|
|
app.include_router(ads.router)
|
|
app.include_router(orders.router)
|
|
app.include_router(payments.router)
|
|
app.include_router(rituals.router)
|
|
app.include_router(uploads.router)
|
|
app.include_router(deploy.router)
|