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

26 行
513 B

  1. from fastapi import FastAPI
  2. from core.config import settings
  3. from db.session import engine
  4. from db.base_model import Base
  5. def startup(): #start the project, and create the tables
  6. app = FastAPI(title=settings.PROJECT_NAME,version=settings.PROJECT_VERSION)
  7. Base.metadata.create_all(bind=engine)
  8. return app
  9. app = startup()
  10. @app.get("/")
  11. def root():
  12. return {"message": "Hello World!"}
  13. @app.get("/user")
  14. def get_users():
  15. return {
  16. {"name": "almaz"},
  17. {"name": "madi"}
  18. }