Files
ns2.0/backend/app/main.py

32 lines
769 B
Python

from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.config import settings
from app.api import apps
app = FastAPI(
title=settings.API_TITLE,
version=settings.API_VERSION
)
app.add_middleware(
CORSMiddleware,
allow_origins=settings.CORS_ORIGINS,
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(apps.router, prefix=settings.API_PREFIX)
@app.get("/")
async def root():
return {"message": "鸿蒙应用展示平台API", "version": settings.API_VERSION}
@app.get("/health")
async def health_check():
return {"status": "healthy"}
if __name__ == "__main__":
import uvicorn
uvicorn.run("app.main:app", host="0.0.0.0", port=8000, reload=settings.DEBUG)