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

32 行
697 B

  1. from fastapi import FastAPI
  2. from core.config import settings, createAdminAcc
  3. from db.session import engine
  4. from db.base import Base
  5. from apis.base import api_router
  6. def include_routes(app): # include all routes from our api/v1/
  7. app.include_router(api_router)
  8. def startup(): # start the project, and create the tables
  9. app = FastAPI(title=settings.PROJECT_NAME, version=settings.PROJECT_VERSION)
  10. Base.metadata.create_all(bind=engine)
  11. createAdminAcc()
  12. include_routes(app)
  13. return app
  14. app = startup()
  15. # Testing stuff
  16. @app.get("/")
  17. def root():
  18. return {"message": "Hello World!"}
  19. @app.get("/user")
  20. def get_users():
  21. return {{"name": "almaz"}, {"name": "madi"}}