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.
 
 

32 line
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"}}