You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

35 line
720 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(
  10. title=settings.PROJECT_NAME,
  11. version=settings.PROJECT_VERSION,
  12. )
  13. Base.metadata.create_all(bind=engine)
  14. createAdminAcc()
  15. include_routes(app)
  16. return app
  17. app = startup()
  18. # Testing stuff
  19. @app.get("/")
  20. def root():
  21. return {"message": "Hello World!"}
  22. @app.get("/user")
  23. def get_users():
  24. return {{"name": "almaz"}, {"name": "madi"}}