feat(api): project initialization

This commit is contained in:
bwstudio
2026-05-21 20:39:14 +08:00
commit 57245cc288
5 changed files with 72 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.config import API_TITLE, API_VERSION
# Create FastAPI application
app = FastAPI(title=API_TITLE, version=API_VERSION)
# Configure CORS
app.add_middleware(
CORSMiddleware,
allow_origins=["*"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def root():
return {"message": "欢迎使用笑话大全 API"}
@app.get("/health")
def health_check():
return {"status": "healthy"}