選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

main.py 697 B

12345678910111213141516171819202122232425262728293031
  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"}}