Serverless Apps with FastAPI
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

123456789101112131415161718
  1. from fastapi import FastAPI
  2. from fastapi.middleware.cors import CORSMiddleware
  3. app = FastAPI()
  4. app.add_middleware(
  5. CORSMiddleware,
  6. allow_origins="*",
  7. allow_credentials=True,
  8. allow_methods=["*"],
  9. allow_headers=["*"],
  10. )
  11. @app.get("/api/health-check/")
  12. def health_check():
  13. return {"message": "OK"}